Sum multiple rows using columns as criteria - excel

I'm trying to sum multiple rows using column headers as criteria but keep coming up blank.
In this table, the range that needs to be summed is D2:F4 but ultimately I'll be summing arbitrary, contiguous date ranges.
All help greatly appreciated. Thanks!
(Sorry no rep yet to post pics)
To return data from the current week (based on Rory's solution):
=SUMPRODUCT((B1:1>=(TODAY()-WEEKDAY(TODAY(),2)+1))*(B1:1<=(TODAY()-WEEKDAY(TODAY(),2)+5))*(B2:4))

You can use SUMPRODUCT for this - eg:
=SUMPRODUCT((B1:Z1>=DATE(2021,9,1))*(B1:Z1<=DATE(2021,9,30))*(B2:Z4))
to sum data for September of this year.

Related

sumif range over mulitple columns

I have the below table in excel
And I want to add a overall line total in for all w/c columns that have a invoice number in the column next to it.
For example I have used =sumif(B2,">0",A2) to bring back the total for w/c 1st but how can i add all values together across the multiple columns - essentially trying to do a sumif multiple range (if that is possible) to get the same result as the below example:
Any help or alternative method to achieve this much appreciated.
You could try:
Formula in I2:
=SUMPRODUCT((ISODD(COLUMN(A2:G2)))*(B2:H2<>"")*A2:G2)

Finding the sum of dates using first column value

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))

Excel formula for calculating occurrences per day

I'm trying to calculate the number of occurrences per day for several columns of data.
Here's an example of my data set:
Data set
Here's how I need to present it:
Present data
Any help is greatly appreciated!
In the Cell W3 of Sheet 2, use the COUNTIFS formula to achieve the desired result. You might need to change the sheet name in the below example or column names.
=COUNTIFS('Sheet1'!$B:$B,'Sheet2'!$A3,'Sheet1'!$A:$A,'Sheet2'!W$2)
and just drag this formula to the right and down and you'll get the desired results.

Sum the product of multiple vlookup or index/match results

I have 2 worksheets, one with multiple columns of data where rows are given years and the other columns are values under the headers of names, and the second sheet lists rates by year (column) and by name (row).
I am trying to take each value in a given column of sheet1 and multiply it by the relevant rate (found by matching the year of each row and the name of its column to the table in sheet2) and then sum the products by name, but can only use a single cell to do all this.
So far I've tried SUMPRODUCT and got to =SUMPRODUCT(O$24:O$514,INDEX(Rates!$A$2:$X$200,MATCH(O$23,Rates!$A$2:$A$67,0),MATCH($D$24:$D$514,Rates!$A$2:$X$2,0))) but this seems to fall down at the MATCH($D$24:$D:$514,Rates!$A$2:$X$2,0) part, even entering as an array.
I've currently resorted to a clumsy series of SUMIF(2016)*INDEX/MATCH(2016 rate)+SUMIF(2015)*INDEX/MATCH(2015 rate) etc, but would really like to have forward compatibility without relying on formulae being updated!
slightly simplified image of the workbook, thanks for any help!

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