Excel – Sum of cells based on a vertical criteria and horizontal date range

microsoft excel

Hoping someone can help me!

I am looking for a formula that will sum a range based on a vertical criteria and a horizontal criteria – but this second one is actually a date range not a single date.

I have dates in row 1 and variables in column A (see linked image below).

I am looking for a formula that will sum multiple cells based on a start and finish date for a certain 'variable'.

For example – In the linked image I have 3 fields that are input (the yellow cells C11, C12 & C13). Using these 3 fields I want it to find the cells they are referring too (the blue cells) and give the sum of these in the "total" (green cell F11)

Can anyone help with a formula?

Click hear for image

Best Answer

Try this solution using SUM & IF in an Array Formula. Sample data is in cells A2:I9. Date format is mm/dd/yyyy in my Excel. C12, C13 & C14 hold Type, From and To dates respectively. Total is displayed in F12.

In F12 put the following formula and press CTRL + SHIFT + ENTER from within the formula bar to create an array formula. The formula shall now be enclosed in curly braces to indicate that it's an array formula. This step is important, the formula shall only work correctly if it's an Array Formula.

=SUM(IF($A$3:$A$9=C12,IF($B$2:$I$2<=C14,IF($B$2:$I$2>=C13,$B$3:$I$9,0))))

enter image description here

Related Question