Sumif, Countif, Maxif ... with a YES qualifier

ellison

Active Member
Joined
Aug 1, 2012
Messages
356
Office Version
  1. 365
Platform
  1. Windows
Hi, we are trying to use the sumif, countif & maxif functions, but with an extra criteria to qualify for the counts = "y"
Hopefully the sheet below may show what we mean a little better!
In other words, we are trying to do different counts for the types of info (Alpha and Beta) depending on if each row has a corresponding "y" in the "Qualifier" column.
Also trying to find best way of showing which actual row of info has the "maxif" for each qualifying info
NB there is always an entry in the info column. But the qty column is sometimes blank. As for example on the entries for "Charlie" in the last few rows


sumif-countif-maxif-with-a-YES-qualifier-question.xlsx
ABCDEFGH
1RowInfoAmtQualifierSumif "y"Countif "y"Maxif "y"Maxif (but only on the appropriate row)
22Alpha100y5003225
33Alpha1505003225
44Alpha175y5003225
55Alpha5003225
66Alpha225y5003225225
77Alpha255003175
88Beta5002252175
99Beta602252175
1010Beta175y2252175175
1111Beta2252175
1212Beta50y2252175
1313Charlie000No Max
1414Charlie000No Max
1515Charlie000No Max
Sheet1




Huge thanks to anybody for taking a look!
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
For the sumifs use
Excel Formula:
=SUMIFS(C:C,B:B,B2,D:D,"y")
and similar for the countifs.
For the max use
Excel Formula:
=LET(m,MAXIFS(C:C,B:B,B2,D:D,"y"),IF(m=0,"No max",IF(C2=m,m,"")))
 
Upvote 0
Solution
Try:

Dante Amor
ABCDEFGH
1RowInfoAmtQualifierSumif "y"Countif "y"Maxif "y"Maxif (but only on the appropriate row)
22Alpha100y5003225 
33Alpha1505003225 
44Alpha175y5003225 
55Alpha5003225 
66Alpha225y5003225225
77Alpha255003175 
88Beta5002252175 
99Beta602252175 
1010Beta175y2252175175
1111Beta2252175 
1212Beta50y2252175 
1313Charlie000No Max
1414Charlie000No Max
1515Charlie000No Max
Hoja4
Cell Formulas
RangeFormula
E2:E15E2=SUMIFS($C$2:$C$15,$B$2:$B$15,B2,$D$2:$D$15,"y")
F2:F15F2=COUNTIFS($B$2:$B$15,B2,$D$2:$D$15,"y")
H2:H15H2=IF(G2=0,"No Max",IF(C2=G2,G2,""))



For the MAXIF:
Excel Formula:
=MAXIFS($C$2:$C$15,$B$2:$B$15,B2,$D$2:$D$15,"y")

😊
 
Upvote 0
Absolutely brilliant Mr Fluff....
"Sumif" all working, "maxif" all working and "maxif but only on the right line" all working.

Just trying to get the countifs working
I tried this below, but an error message popped up: "you've entered too few arguments for this function"

VBA Code:
=COUNTFS(C:C,B:B,B2,D:D,"y")
 
Upvote 0
All sorted now, with huge thanks!

I used Mr Fluff's solution for the sumif, maxif and maxif but only on the appropriate row.

And Dante's suggestion on the countif:

VBA Code:
=COUNTIFS(B:B,B2,D:D,"y")

Thanks again one and all!!!!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,737
Messages
6,180,668
Members
452,992
Latest member
TokugawaIesuma

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