Finding the sum of dates using first column value - excel

So I am working in excel and have two columns, as shown below.
What I wish to do is to able to get the sum of yearly deadlines for A, B and C.
So that:
Get a sum of dates within Year 2020 for each Variable
Get a sum of dates within Month/Year for each specific A,B and C.
Currently, I have been using a long approach. I use a Vlookup for each row getting a filtered table for each Variable. Then using that I filter out Dates using combination of Countif and Countifs. But the problem with that approach is that I end up getting huge rows and table of data in the end increasing the file size.
I have also tried to use sumproduct() but I do not have numbers so I can not find a sum.
Is there a smart way of doing it using one formula?
Thank you.

Use SUMPRODUCT. For year/variable:
=SUMPRODUCT(($A$2:$A$13=E2)*(YEAR($B$2:$B$13)=$F$1))
for month/year/variable:
=SUMPRODUCT(($A$2:$A$13=$E2)*(YEAR($B$2:$B$13)=$F$1)*(MONTH($B$2:$B$13)=G$1))

Related

Excel Sumifs using numbers stored as text in criteria

I am trying to use the SUMIFS() formula in excel to exclude certain rows from a table, but the criteria range includes numbers stored as text.
In the picture below I want to exclude the rows where entity id is "101000". The SUMIFS() formulas I have tried all provide the incorrect solution.
I found similar problems (here and here). This is where I came up with the SUMPRODUCT alternative.
I am trying to see if there is an alternative using SUMIFS. The syntax of SUMPRODUCT is confusing. But more importantly it doesn't work if I have entity id's that both translate to the same number value ('0100' and '00100').
If you are using Office 365 you can combined the FILTER and SUM functions.
First FILTER the amounts
=FILTER(C4:C9,B4:B9<>"01000")
Then SUM the filtered amounts
=SUM(FILTER(C4:C9,B4:B9<>"01000"))
You can sum the rows whose IDs do match, and then subtract it from the total sum:
=SUM($C$4:$C$6)-SUMIF($B$4:$B$6,"101000",$C$4:$C$6)

Returning sum of column for filtered data, without filter

I'm trying to calculate the sum of a column (TSQFT in the screenshot) that is part of a data set, which would be filtered based on multiple criteria using cell references (see screenshot). I don't want to use excel's regular filter as it's a hassle to change the settings and I'd like it to be done in a more automated way.
I've tried {SUMIF} and {SUMIFS} but those do not work as a filter - i.e. for a row to be {TRUE}, the numbers have to be in the same order as that specified in the criteria list {5-7-2} (see screenshot).
Would much appreciate any help.
You can try something like this:
Make 3 column of =IF(OR(C3=$C$10;C3=$D$10;C3=$E$10);1;0) formulas, one more column for a sum of this 3 column and a sumif based of the sum values
if the sum is 3 then the value is good.
This maybe the worst solution for this but as long as it can help, it can be developed into something better.

Have A Dynamic Sum Function in Excel

So, I feel like I'm trying to do something fairly simple in Excel here. My company has a Spreadsheet with 2 columns and an indefinite number of rows. Column A is the Date, Column B is a production number for that date. At the bottom of Column B is the total production number. However, every time we update the spreadsheet we have to update the formula to include the newest data on every page. We insert columns for the new dates, so is it possible to have a function that changes based on it's current coordinate? For example something like =SUM(B3:B(CurrentRow-1)).
Use this:
=SUM($B$3:INDEX(B:B,ROW()-1))
It is non volatile and will sum everything from B3 to the row in Column B above where the formula is placed.
Hi You can use the below excel formula to achieve the result you are looking at.
If the values you want to sum up is in column B, then type the below formula and it will show the value dynamically when ever you have added a value to the column.
=SUM(INDIRECT("B2:B"&COUNTA(B:B)-1))

Sorting formulas issue

I have a table which consists of names (1st column) avarageifs (2-6 columns) and average formulas (7 column).
Averageifs formula is taking the name to average values for each name:
=IFERROR(AVERAGEIFS(Grades!B:B,Grades!$A:$A,Rankings!$B14),"N/A")
"Total" average formula is:
=IFERROR(AVERAGE(C14:G14),0)
Then I am trying to sort it by "total" average, formulas are mixing up and referring to different rows.
But it should refer to the same row. What happens after sorting and how can I fix it?
Basically the references in the AVERAGEIFS formulae are getting swapped around and you don't want this to happen.
The easiest way round it would be to put the Totals column next to the Names column and just sort these two columns, leaving the other formulae in place.
If you don't want to do that, a fairly quick and dirty solution is to replace the AVERAGEIFS formulae with this so they always refer to the current row:-
=IFERROR(AVERAGEIFS(Grades!B:B,Grades!A:A,INDIRECT("Rankings!$B"&ROW())),"N/A")
See the discussion here

Excel SUMIF between dates

I have column A with date values formatted as mm/dd/yyyy. I am trying to sum the values of column B if A >=DATE(2012,1,1) AND
=SUM(B:B) sums B properly, but if I try to use =SUMIF(B:B,A:A>=DATE(2012,1,1)) the value returned is 0.00. I'm assuming this has something to do with using decimal for the sum and date type for the criteria. Is there a way to get around this?
Thanks
You haven't got your SUMIF in the correct order - it needs to be range, criteria, sum range. Try:
=SUMIF(A:A,">="&DATE(2012,1,1),B:B)
To SUMIFS between dates, use the following:
=SUMIFS(B:B,A:A,">="&DATE(2012,1,1),A:A,"<"&DATE(2012,6,1))
I found another way to work around this issue that I thought I would share.
In my case I had a years worth of daily columns (i.e. Jan-1, Jan-2... Dec-31), and I had to extract totals for each month. I went about it this way: Sum the entire year, Subtract out the totals for the dates prior and the dates after. It looks like this for February's totals:
=SUM($P3:$NP3)-(SUMIF($P$2:$NP$2, ">2/28/2014",$P3:$NP3)+SUMIF($P$2:$NP$2, "<2/1/2014",$P3:$NP3))
Where $P$2:$NP$2 contained my date values and $P3:$NP3 was the first row of data I am totaling.
So SUM($P3:$NP3) is my entire year's total and I subtract (the sum of two sumifs):
SUMIF($P$2:$NP$2, ">2/28/2014",$P3:$NP3), which totals all the months after February and
SUMIF($P$2:$NP$2, "<2/1/2014",$P3:$NP3), which totals all the months before February.
this works, and can be adapted for weeks or anyother frequency i.e. weekly, quarterly etc...
=SUMIFS(B12:B11652,A12:A11652,">="&DATE(YEAR(C12),MONTH(C12),1),A12:A11652,"<"&DATE(YEAR(C12),MONTH(C12)+1,1))
One more solution when you want to use data from any sell ( in the key C3)
=SUMIF(Sheet6!M:M;CONCATENATE("<";TEXT(C3;"dd.mm.yyyy"));Sheet6!L:L)

Resources