Complex sumifs formula with multiple criteria

korhan

Board Regular
Joined
Nov 6, 2009
Messages
215
Hi everyone,

I am trying to implement a count formula using sumifs but I couldn't wrap my head around it.
I want to be able to count member depending on the code column. Anything less than or equal 3. Also, date will be another criteria.
Trickiest part is amount will be a criteria for counting the member. If the amount is negative, count member as negative and if positive just count ( add) as positive.
Any ideas?
[TABLE="width: 500"]
<tbody>[TR]
[TD]Date[/TD]
[TD]Code[/TD]
[TD]Member[/TD]
[TD]Amount[/TD]
[/TR]
[TR]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65, width: 64, align: right"]1/1/2017[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]1[/TD]
[TD]12[/TD]
[TD]$200[/TD]
[/TR]
[TR]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65, width: 64, align: right"]1/1/2017[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]$100[/TD]
[/TR]
[TR]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65, width: 64, align: right"]1/1/2017[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]1[/TD]
[TD]123[/TD]
[TD]-$50[/TD]
[/TR]
[TR]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65, width: 64, align: right"]1/1/2017[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]3[/TD]
[TD]5[/TD]
[TD]-$20[/TD]
[/TR]
[TR]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65, width: 64, align: right"]1/1/2017[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]1[/TD]
[TD]6[/TD]
[TD]$25[/TD]
[/TR]
[TR]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65, width: 64, align: right"]1/1/2017[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]4[/TD]
[TD]7[/TD]
[TD]-$100[/TD]
[/TR]
[TR]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65, width: 64, align: right"]2/1/2017[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]3[/TD]
[TD]8[/TD]
[TD]$55[/TD]
[/TR]
[TR]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65, width: 64, align: right"]2/1/2017[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]2[/TD]
[TD]6[/TD]
[TD]$23[/TD]
[/TR]
[TR]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65, width: 64, align: right"]2/1/2017[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]1[/TD]
[TD]6[/TD]
[TD]$42[/TD]
[/TR]
[TR]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65, width: 64, align: right"]2/1/2017[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]1[/TD]
[TD]9[/TD]
[TD]-$25[/TD]
[/TR]
[TR]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65, width: 64, align: right"]2/1/2017[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]5[/TD]
[TD]10[/TD]
[TD]$25[/TD]
[/TR]
[TR]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65, width: 64, align: right"]2/1/2017[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]3[/TD]
[TD]9[/TD]
[TD]$23[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
These are just random numbers.
It is just a number. Think of it like you are counting a member for how many times they visited your store.
 
Last edited:
Upvote 0
So if I am understanding it correctly, Member number 6 for 02/01/2017 should give a count of 2 , whereas member number 9 for the same date should give a count of 0?
 
Upvote 0
Look at it this way, on 02/01/2017 counting the member visits, I should get 30.
If the $ amount is negative count that visit as negative.
8 + 6 + 6 - 9 + 10 + 9.
Most of these visits left positive $ amounts so count them as positive. There is only one negative amount so subtract that from the total visits.
 
Upvote 0
Yes, you are right. I have missed that. It should be 20.
Thanks for correcting me.
 
Upvote 0
can you check if this does what you Want?


Excel 2013/2016
ABCDEFG
1DateCodeMemberAmount
201/01/201711220002/01/201720
301/01/201712100
401/01/20171123-50
501/01/201735-20
601/01/20171625
701/01/201747-100
802/01/20173855
902/01/20172623
1002/01/20171642
1102/01/201719-25
1202/01/201751025
1302/01/20173923
Sheet3
Cell Formulas
RangeFormula
G2=SUMPRODUCT(SUMIFS($C$2:$C$13,$A$2:$A$13,F2,$B$2:$B$13,"<4",$D$2:$D$13,{"<0",">0"}),{-1,1})
 
Upvote 0
Yes, that does it. Thanks a lot.
Couple of questions, how were you able to neatly copy paste your table into here?
Secondly, can you give a brief explanation on how this formula is able to do what I wanted.
I appreciate your time.
 
Upvote 0
how were you able to neatly copy paste your table into here?

download mrExcel HTML Maker:
https://onedrive.live.com/?id=8CFFDEC0CE27E813!189&cid=8CFFDEC0CE27E813

can you give a brief explanation on how this formula is able to do what I wanted
it is a simple sumif formula but that uses an array as a last argument to return in an array those with condition less than 0 and those more than 0. then sumproduct will multiply those less than 0 by -1 and those above 0 by 1 and sum them together, in fact doing a subtraction
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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