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!
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Hi,

Something like this?


Book1
ABCDEFGHI
1BPJanuaryItem A56756JanuaryFebruaryMarch
2BPJanuaryItem B4353BP61109676924577
3BPFebruaryItem A235
4BPFebruaryItem B67457
5BPMarchItem A4577
6ExpensesJanuaryItem A3452
7ExpensesFebruaryItem A345
8ExpensesJanuaryItem B577
9ExpensesFebruaryItem B4677
Sheet25
Cell Formulas
RangeFormula
G2=SUMIFS($D1:$D9,$A1:$A9,$F2,$B1:$B9,G1)


G2 formula copied across.
 
Upvote 0
Hmmm... not quite!

In one cell I need a formula that sum values in column D that belongs to BP but only from months in column B associated with Expenses. In my example, the formula should sum values that match January and February from BP. The answer shall be: 56756 + 4353 + 235 + 67457 = 128801
 
Upvote 0
Hmmm... not quite!

In one cell I need a formula that sum values in column D that belongs to BP but only from months in column B associated with Expenses. In my example, the formula should sum values that match January and February from BP. The answer shall be: 56756 + 4353 + 235 + 67457 = 128801


Book1
ABCDEFGHI
1Column AColumn BColumn CColumn DMonthBP ExpensesTotalFormula
2BPJanuaryItem A56756January261109=IF(G2>0,SUMIFS(D:D,A:A,"BP",B:B,F2),0)
3BPJanuaryItem B4353February267692=IF(G3>0,SUMIFS(D:D,A:A,"BP",B:B,F3),0)
4BPFebruaryItem A235March00
5BPFebruaryItem B67457April00
6BPMarchItem A4577May00
7ExpensesJanuaryItem A3452June00
8ExpensesFebruaryItem A345July00
9ExpensesJanuaryItem B577August00
10ExpensesFebruaryItem B4677September00
11October00
12November00
13December00
14128801
Sheet1
Cell Formulas
RangeFormula
G2=COUNTIFS(A:A,"Expenses",B:B,F2)
H2=IF(G2>0,SUMIFS(D:D,A:A,"BP",B:B,F2),0)
 
Upvote 0
Yeah, but won't help me in this case. Actually, need a more complex formula that will solve this matter in one single cell.

Thank you!
 
Upvote 0
It looks like the Expenses rows are a separate table, if so you can write the formula as:


Excel 2010
ABCD
1Column AColumn BColumn CColumn D
2BPJanuaryItem A56756
3BPJanuaryItem B4353
4BPFebruaryItem A235
5BPFebruaryItem B67457
6BPMarchItem A4577
7ExpensesJanuaryItem A3452
8ExpensesFebruaryItem A345
9ExpensesJanuaryItem B577
10ExpensesFebruaryItem B4677
11
12128801
Sheet1
Cell Formulas
RangeFormula
D12=SUMPRODUCT(--(COUNTIF($B$7:$B$10,$B$2:$B$6)>0),$D$2:$D$6)


The BP condition can be added if there are others you wish to leave out.
 
Last edited:
Upvote 0
You can't sort the table so all the Expenses rows are at the bottom? Are there others holding months criteria as well?
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,315
Members
452,634
Latest member
cpostell

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