Sumproduct between dates with additional criteria across columns - excel

Im trying to put together a sumproduct formula that looks between two dates and has a criteria across columns.
I have the following:
Start Date:
Sheet1!A1
End Date:
Sheet1!A2
Criteria Field: Sheet1!A3
I want to sum columns Sheet2!B2:F200 where Sheet2!A2:A200 is between the Start and End dates on Sheet1 and where Sheet2!B1:F1 equal the criteria field from Sheet1
I made it to here but I'm not able to sum across columns or add in the criteria field.
SUMPRODUCT(--(Sheet2!A2:A200>=Sheet1!A1),--(Sheet2!A2:A200<=Sheet1!A2),Sheet2!C:C)

Use SUMIFS with INDEX to return the correct column:
=SUMIFS(INDEX(Sheet2!$B:$F,0,MATCH(Sheet1!A3,Sheet2!$B1:$F$1,0)),Sheet2!$A:$A,">=" & Sheet1!A1,Sheet2!$A:$A,"<=" & Sheet1!A2)

Related

countifs same criteria in diffrent criteria ranges

Need to countifs values between two dates and need to lookup same criteria in different criteria ranges (columns I,J,K) values.I used below formula in N6.Answer should 3.between given dates how many rows are common for given line no in(M4) between given start and end date.Please advise.
=COUNTIFS(A2:A7,">="&N2,A2:A7,"<="&N3,H2:H7,"PASS",I2:I7,M4,J2:J7,M4,K2:K7,M4)
As long as 33A occurs just once in columns I-K you could use:
=SUMPRODUCT((A2:A7>=N2)*(A2:A7<=N3)*(H2:H7="PASS")*(I2:K7=M4))

Sumproduct with mapping multiple rows and match through the rows

want to write excel formula that will sum the values based on a match of the rows. The cells to be matched can occur multiple times and basing on the Mapping legend they should return the sum of values.
In the yellow cells I am trying to calculate sum of values in range B9:B21 based on a match of the names in G3:G8 according to Mapping legend to Item1, then Item2 and Item 3. Also I want to consider the sum to be done across Date 1, Date 2 and Date 3. The SumProduct formula below works only
if I use it on sum array for a single date but not across date1 , date2 and date 3:
Does sombody know how to fix this?
I would like to add that I want to have the fomrula to be identical in each yellow cell without splitting the arrays across the dates. The more, it is important in the formula to have it on the basis that 'date 1', 'date2' and 'date3' are matched.
Put this array formula into B2 with CSE then fill right and down.
=SUM(SUMIFS(INDEX($B$8:$D$19, 0, MATCH(B$1, $B$7:$D$7, 0)), $A$8:$A$19, IF($F$2:$F$7=$A2, $G$2:$G$7)))

Sumif formula on row determined by a criteria within column

I have been trying to create a formula that decides whether a row matches a criteria, and then sums data in the row based on a second criteria. I have tried my luck with LOOKUP,VLOOKUP, HLOOKUP, and INDEX, but have not figured out a correct formula. The most common error I get back is #Value when the sum would take place.
Example:
Let's say that the formula is in Q2. The formula needs to be able to match up A123 with the row A-123-4 (A2) and then sumif the row as long as the cells in that row are within the proper month MONTH($B$11:$I$11)=1
What I made initially was this:
{=SUM(IF(MONTH($B$11:$I$11)=1,$B2:$I2,0))}
The problem is that both of these are tables, so if the information gets rearanged using a filter, the data shifts. How can I get the formula to determine which row is the proper row to sumif?
Use This in Q2 and copy over and down:
=SUMPRODUCT(INDEX($B:$I,MATCH(LEFT($P2) & "-" &MID($P2,2,LEN($P2)) & "*",$A:$A,0),0)*(MONTH($B$11:$I$11) = MONTH(Q$1)))

How to use countifs function to count multiple criteria involving dates?

=COUNTIFS($C$2:$C$20000,MONTH(8),$K$2:$K$20000,"U")
Where C column is the list of dates, K column is another criteria i want to meet.
Here I'm attempting to count whenever Column C is within the month of August and Column K value is "U", the above formula i used return 0 where I expecting some values.
Not sure what is the problem with my formula.
Month() formula won't work inside COUNTIFS formula, you can use SUMPRODUCT instead:
=SUMPRODUCT((MONTH($C$2:$C$20000)=8)*($K$2:$K$20000="U"))
Or add an extra column to your data, calculate month in it, and use COUNTIFS with the new column.

SUMIFS with date and name criteria... month and year only

I am trying to get a SUMIFS formula to check a column of dates and sum only the values that correspond to the matching year and month of the criterion date. I would also like this SUMIFS to include a name criterion along with the date. i.e.
Cell A1: =SUMIFS('Sheet1'!O:O, 'Sheet1'!D:D, 'Sheet2'!DATE(B2), 'Sheet1'!E:E, "Name")
sheet1 column O is where the sum values are stored
sheet1 column D is where the date values are stored
sheet2 cell B2 is where the date comparison criterion is stored
sheet1 column E is where the names are stored
"Name" is the name criterion that I want for sum selection
Any insight will be most appreciated!
You can use SUMIFS if you create a start and end date for your dates, i.e. with this version
=SUMIFS('Sheet1'!O:O,'Sheet1'!D:D, ">="&EOMONTH('Sheet2'!B2,-1)+1, 'Sheet1'!D:D, "<"&EOMONTH('Sheet2'!B2,0)+1, 'Sheet1'!E:E, "Name")
EOMONTH is used to get the start and end dates of the relevant month then your SUMIFS sums the correct values based on your other criteria.
If B2 is guaranteed to be the first of the month you can omit the first EOMONTH function
Solution with SUMPRODUCT
I find it simpler to use SUMPRODUCT in situations like this.
For no header row you can simple use:
=SUMPRODUCT((MONTH(Sheet1!D:D)=MONTH(Sheet2!$B$2))*(YEAR(Sheet1!D:D)=YEAR(Sheet2!$B$2))*(Sheet1!E:E="Name"),Sheet1!O:O)
Just replace "Name" with what you want.
If you have a header row (or if the column contains any values that are not valid dates) you need to use an array formula within SUMPRODUCT:
=SUMPRODUCT((IF(ISERROR(MONTH(Sheet1!D:D)),Sheet1!D:D,MONTH(Sheet1!D:D))=MONTH(Sheet2!$B$2))*(IF(ISERROR(YEAR(Sheet1!D:D)),Sheet1!D:D,YEAR(Sheet1!D:D))=YEAR(Sheet2!$B$2))*(Sheet1!E:E="Name"),Sheet1!O:O)
(Array formulas are entered using ctrl + shft + enter)

Resources