I need the updated sum from 1st to the current date - excel

I have extracted the cell address of the current date by using:
=CELL("Address",INDEX($H$4:$AK$4,MATCH(G3,H4:$AK$4,1)))
G3 contains the day number of the month.
Now I need to use the Sum formula in G6 such that it adds the values from 1st to the current date which is updated by the function Today() in cell G1.
Is there a way I can use the Sum function to use the address inside the cell rather than the address of the cell.
You can download the sheet from here.

I think you are making it too difficult. Just use SUMIF, and make the criteria that the dates are less than today.
=SUMIF(date_range, "<"&TODAY(), sum_range)

Related

COUNTIFS in Google Sheets

I am trying to create a countifs formula that counts cancellation dates of clients by month, but the condition I want to also implement is not to count if the cancellation date was today's date (which is input in cell B1 at the top of the document).
So, for the november row, i have the formula =ArrayFormula(countif(month(H4:H89),11)) which works to count every cancellation date that happened in the month of november, but I want to add a condition that says, "but don't count if date =B1 enter code here where B1 contains that day's date.
I've tried converting the conditions in the array formula to a countifs formula but it never seems to work. Please help!
Use COUNTIFS:
=ArrayFormula(COUNTIFS(A2:A,"<>"&B2,MONTH(A2:A),11))

Referring to a cell in a formula, but wanting to use the cell reference in that cell, not that actual cell itself

I want to make it so I can build a count formula in one sheet that I can just drag down.
the cells being counted are on a different sheet.
Start Ref Date
29-Mar
19-Dec 37
21-Jan 29
28-Feb 14
Essentially what is happening here is that the numbers that are NOT dates are the counted cells between the Ref Date and the Start (what I am tracking doesn't follow a calendar so I can't just subtract the start from the ref date).
I hard coded the count formula to get each of the number of days between ref and start. I'm lazy. I want to make it so the count refers to the referenced value in the start and ref date columns.
current forumla:
=COUNT('SHEET1'!FQ$1:HA$1)
Desired Forumla:
=COUNT($B3:$B$2) where B3 is the referred to start taken from Sheet 1 and B2 is the ref date taken from Sheet 1. That way I only have to change B2 in order to update the count.
How can I refer to a specific value in a cell that is taken from a different sheet???
thanks for the help so far. I'm not sure excel itself can do everything I want it to. I ended up taking an online course in macro's and VBA for Excel.
This solution assumes the dates to count are layed out as below on sheet2:
Lay out your start and reference dates similar to the following:
In cell D3 from the above example, use the following formula:
=COUNTIFS(Sheet2!$C$3:$J$3,">="&Sheet1!B4,Sheet2!$C$3:$J$3,"<="&Sheet1!C4)
That formula can be copied down as required to match your entries for start and reference dates.

Excel SUM range of cells based on two delimiting values of another range

My problem:
I have the below tables:
In my second table (tbl_analysis), I need to create a formula in the Sum column that will sum the salary of a certain person over a certain period. When the period changes, the formula needs to be recalculated.
My try:
I started off by using the formula:
=SUM(my_range)
By the range can't be hard-coded, so I decided to find the cell address of the corresponding month as you can see in the range D12:E15
Formula in the cell D12:
=CELL("address",INDEX($A$2:$M$8,MATCH(A12,$A$2:$A$8,0),MATCH(B12,$A$2:$M$2,0)))
So when I tried to insert the above formula inside of the SUM formula like this:
=SUM(CELL("address",INDEX($A$2:$M$8,MATCH(A12,$A$2:$A$8,0),MATCH(B12,$A$2:$M$2,0)))
: CELL("address",INDEX($A$2:$M$8,MATCH(A12,$A$2:$A$8,0),MATCH(C12,$A$2:$M$2,0))))
And then Excel is referecing the cell address itself and not the address inside of the formula.
Skip the Addresses and use this based on the months:
=SUM(INDEX(A:M,MATCH(A12,A:A,0),MATCH(B12,$2:$2,0)):INDEX(A:M,MATCH(A12,A:A,0),MATCH(C12,$2:$2,0)))
Scott Craner has the right solution for this scenario and it makes more sense here. However if you would absolutely need to get cell reference from a cell you would be able to do it using the following function:
INDIRECT(cell)
Usually this isn't necessary but it can be handy when you want to break up a long formula where you would need to find a row number for example.
INDIRECT("A" & B2)
Where B2 has the row number for a dynamic range or specific moving target row.
INDIRECT function documentation

How can I copy row values based on the value of one of the cells in that row?

Column A consists of a series of dates extending from today into the future.
Columns B-E are other values corresponding to those dates.
Initially the first three rows were blank. Then I used the function TODAY() to obtain today's date and put that in cell A1. Today's date matches a value in cell A91. I now want the values in B1-E1 to match the values in B91-E91.
How can I go about doing that? It needs to be done with reference to cell A1 because I want it to update whenever the spreadsheet is opened. Thus I can't just type =B91 in B1.
Here's what it looks like
I am working in Google Spreadsheets but I suspect an answer related to Microsoft Excel would probably work here too.
The VLOOKUP function works, for example
=VLOOKUP(A1,$A$3:$E$1000,2,FALSE)

How to write a custom formula so that Drag option does not take the cell formula in series?

I have an excel sheet with revenues generated daily. For Saturdays, sundays and other public holidays, the cell will be empty.
In another sheet I need to generate a weekly report where I need to show only the last generated revenue of that week. For example, a week starts from Monday and ends with Sunday. Satruday and sunday cells will be empty. So in Sheet2 A1 I should display Friday's revenue. Or if the current day is tuesday, it should show tuesday's revenue. I used the below formula to populate the value.
=IF('Sheet1'!A1<>"",IF('Sheet1'!B1<>"",IF('Sheet1'!C1<>"",IF('Sheet1'!D1<>"",IF('Sheet1'!E1<>"",IF('Sheet1'!F1<>"",IF('Sheet1'!G1<>"",'Sheet1'!G1,'Sheet1'!F1),'Sheet1'!E1),'Sheet1'!D1),'Sheet1'!C1),'Sheet1'!B1),'Sheet1'!A1),"")
However if I drag from cell A1 to B1 in sheet 2, it should consider week2 days, ie., column 8 to 14 and so on, but not 2 to 8.
So what would be the excel formula that I should be using?
Thanks in advance
Microsoft give this formula to determine which is the last cell filled with data:
=OFFSET(<StartCell>,0,MATCH(MAX(Range)+1,<Range>,1)-1)
Using OFFSET to get the range to check, and ROW() to determine which area, we can make the start cell OFFSET($A$1,(ROW()-1)*7,0) (assuming you have this in the 1st row, otherwise alter the -1 in the formula). The range becomes almost the same, but we tell OFFSET to return 7 cells: OFFSET($A$1,(ROW()-1)*7,0,7). We use $ to fix the cell, as we don't want to have to calculate offset from a variable position. This gives the full formula as:
=OFFSET(OFFSET(Sheet1!$A$1,(ROW()-1)*7,0),MATCH(MAX(OFFSET(Sheet1!$A$1,(ROW()-1)*7,0,7))+1,OFFSET(Sheet1!$A$1,(ROW()-1)*7,0,7),1)-1,0)
and this can be copied down as far as needed - you will start to get #N/A when the formula runs out of data to look at.
Any easier way of doing this might be to have a hidden row that looks to see if cell A1, B1 etc has a value in it, and to see if the next one is blank. And return a 1 when that statement is true, because that'll be the last one.
Then you just lookup the column that has a 1 in it using V or HLOOKUP.
It's easier to read, and you can use it across many more columns without having to make your formula bigger.

Resources