SUMIFS Tricky Multiple Criteria

rlobera

New Member
Joined
Mar 9, 2017
Messages
38
Office Version
  1. 2019
Platform
  1. MacOS
Hi guys!

Need some help regarding this matter. I have something like this data in a table:

[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD]Column A[/TD]
[TD]Column B[/TD]
[TD]Column C[/TD]
[TD]Column D[/TD]
[/TR]
[TR]
[TD]BP[/TD]
[TD]January[/TD]
[TD]Item A[/TD]
[TD]56756[/TD]
[/TR]
[TR]
[TD]BP[/TD]
[TD]January[/TD]
[TD]Item B[/TD]
[TD]4353[/TD]
[/TR]
[TR]
[TD]BP[/TD]
[TD]February[/TD]
[TD]Item A[/TD]
[TD]235[/TD]
[/TR]
[TR]
[TD]BP[/TD]
[TD]February[/TD]
[TD]Item B[/TD]
[TD]67457[/TD]
[/TR]
[TR]
[TD]BP[/TD]
[TD]March[/TD]
[TD]Item A[/TD]
[TD]4577[/TD]
[/TR]
[TR]
[TD]Expenses[/TD]
[TD]January[/TD]
[TD]Item A[/TD]
[TD]3452[/TD]
[/TR]
[TR]
[TD]Expenses[/TD]
[TD]February[/TD]
[TD]Item A[/TD]
[TD]345[/TD]
[/TR]
[TR]
[TD]Expenses[/TD]
[TD]January[/TD]
[TD]Item B[/TD]
[TD]577[/TD]
[/TR]
[TR]
[TD]Expenses[/TD]
[TD]February[/TD]
[TD]Item B[/TD]
[TD]4677[/TD]
[/TR]
</tbody>[/TABLE]

What I need is to sum the numbers in column D that belongs to BP in column A, and only from the months associated to Expenses in column A. Please note that the months in column B are not formatted as DATE but as TEXT. Column C is not used.

Thanks!
 
I know it would be much easier, but in this case, I'm not allowed to use VBA for security reasons.

I thought about using INDEX and MATCH within the SUMIF or SUMIFS, but I'm burned out and couldn't figure out a solution just yet.
 
Upvote 0

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
My solution worked though, do you really need it all to be in one cell? Can you not add a helper page, use my solution, then hide that page?
 
Upvote 0
I can get this done with just 1 helper column, you can hide that column (in my sample, Column E)


Book1
ABCDEF
1BPJanuaryItem A5675656756128801
2BPJanuaryItem B43534353
3BPFebruaryItem A235235
4BPFebruaryItem B6745767457
5BPMarchItem A4577
6ExpensesJanuaryItem A3452
7ExpensesFebruaryItem A345
8ExpensesJanuaryItem B577
9ExpensesFebruaryItem B4677
Sheet25
Cell Formulas
RangeFormula
E1=IF(A1="BP",IF(COUNTIFS(A$1:A$9,"Expenses",B$1:B$9,B1)>0,D1,""),"")
F1=SUM(E1:E9)
 
Upvote 0
Yes guys, I know that with a helper page or column you are approaching the solution, but it's not what I'm actually looking for.

I'm pretty sure that combining multiple formulas in one cell we would be able to solve it!
 
Upvote 0
Try the Array Formula (use Ctrl+Shift+Enter to enter the formula) below:

=SUM(IF(ISNUMBER(MATCH(IF($A$2:$A$10="BP",$B$2:$B$10,"A"),IF($A$2:$A$10="Expenses",$B$2:$B$10,"B"),0)),$D$2:$D$10))

Markmzz
 
Upvote 0
Try the Array Formula (use Ctrl+Shift+Enter to enter the formula) below:

=SUM(IF(ISNUMBER(MATCH(IF($A$2:$A$10="BP",$B$2:$B$10,"A"),IF($A$2:$A$10="Expenses",$B$2:$B$10,"B"),0)),$D$2:$D$10))

Markmzz

What do you mean with "A" and "B"?
 
Upvote 0
Mark, you are a magician with Excel. It works like a charm.

Thanks man!

Best,
R.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,335
Members
452,636
Latest member
laura12345

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