SUMIF formula in multiple dimensions

addictedtonumbers

New Member
Joined
Mar 15, 2017
Messages
3
I have a question on how to approach the below problem.

Let's say I have monthly sales data in the array B5:E9. The columns are the total sales in a month, noting the month is indicated by the first date of each month. The rows are Black sales and Blue sales which are product types.

I want to have a formula that answers this question:
For months earlier than the reference date of 31/03/2019 in cell B1, how many blue sales were there? The sum is the sum of the cells indicated in red below. The idea is that if cell B1 changes, then the answer will also change.

I suspect the answer will be a mixture of a SUM/SUMIF/OFFSET formula, maybe INDEX(MATCH) or a SUMPRODUCT? I'm comfortable with these formulae, but get stuck when I have to combine them.

Thank you for your help in advance :)

ABCDE
1Reference date31/03/2019
2
3
401/01/201901/02/201901/03/201901/04/2019
5Black161116
6Blue271217
7Black381318
8Black491419
9Blue5101520
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Apologies! The above colours in red are incorrect. The numbers should be in row 9, not row 8.

I haven't quite figured out how to edit posts just as yet. Sorry for any confusion!
 
Upvote 0
Here's away with SUMPRODUCT

Book1
ABCDE
1Reference date3/31/2019
251
3
41/1/20192/1/20193/1/20194/1/2019
5Black161116
6Blue271217
7Black381318
8Black491419
9Blue5101520
Sheet1
Cell Formulas
RangeFormula
B2B2=SUMPRODUCT((B4:E4<=B1)*(A5:A9="Blue")*(B5:E9))
 
Upvote 0
Thank you, AhoyNC, for this. It worked perfectly. I didn't realise that syntax in the format (A5:A9="Blue") could be used in the SUMPRODUCT formula. Thank you!
 
Upvote 0
You're welcome. Thanks for the feedback. When you multiply (A5:A9="Blue") the TRUE & FALSE turn into 1 & 0's.
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,691
Members
449,117
Latest member
Aaagu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top