Max with criteria

toony

Board Regular
Joined
Mar 20, 2014
Messages
91
Office Version
  1. 365
Hi. I have the below issue.

I have the below formula that works;
=MAX(IF(AD:AD="office supplies",AP:AP))

Then I have this othee formula which gives me 0 for the Furniture criteria......but the highest is not 0....
It's just the same formula but different criteria. I checked the spellling and all but can't just see why it woul give me 0 value. Any ideas?
=MAX(IF(AD:AD="Furniture",AP:AP))
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
what version of excel ?
any spaces either side of the text ?

if an older version of excel - not 365 , then you will probably need to enter as an array
“Ctrl+Shift+Enter”
so you will see {} around the formula - but

365 version automatically makes array formulas arrays

Also its not good practice to refer to full columns - a range of rows maybe more efficient

if you actually type in furniture into a cell and then a number, does it pickup that number ?
 
Upvote 0
If you're not using an ancient version of Excel then you can use MAXIFS() with full column references, without risk of performance issues.

For example:
=MAXIFS(AP:AP,AD:AD,"Furniture")

To help diagnose your specific issue, what does the below formula return when placed in a spare cell and the AD1 reference changed to a cell that looks to contain the text "furniture"?

Excel Formula:
=AD1="Furniture"
 
Upvote 0
Another option with "regular" formula.

Excel Formula:
=SUMPRODUCT(MAX((AD1:AD1000="Furniture")*(AP1:AP1000)))

It is recommended in any formula to use a certain range.
 
Upvote 0
Another option with "regular" formula.

Hi Dante, your suggested formula is not "regular" and suffers exactly the same performance issues as the OP's

It is recommended in any formula to use a certain range.

To some extent, but with maxifs() and their kind, you'd be hard pressed to notice any difference in performance in a real world scenario using full column references or not.
 
Upvote 0
Hi Dante, your suggested formula is not "regular" and suffers exactly the same performance issues as the OP's
I know and that's why I put it in quotes, and I also know about the performance problem, that's why my recommendation, which doesn't hurt.
 
Upvote 0
Then why even offer it as an alternative :unsure:
Sometimes users have trouble entering array formulas with shift + control + enter, it is an alternative to enter the formula with just enter.
If they don't have 365, it's still a viable alternative.
 
Upvote 0
Hi. Thank you all. None is actually working. The strange part is that the same formula (=MAX(IF(AD:AD="office supplies",AP:AP))) works just fine for the "Support Office" criteria but not for "Furniture". Strange. I have used a range as advised.
My MS is 2016 (Microsoft® Excel® 2016 MSO (Version 2112 Build 16.0.14729.20254) 64-bit)

The feedback for each of you is as follows, but no success to summarise;
- Etaf: I've entered it as arrary formula with “Ctrl+Shift+Enter” and it seems it to work but actually not. It was giving me 0 with mine. With the array formula is gives me 7 which is not correct. The result for the Furniture criteria should be 3.
- FormR; the below funtion I don't have access to it. I have formulated =AD2="Furniture" and it gives the relevant "TRUE" statement.
This was a simply and interesting diagnosis excersice actually thanks. Would this also be called validation?
=MAXIFS(AP:AP,AD:AD,"Furniture")-
- DanteAmor; The below gives me 0 result which should be 3 actually for Furniture.
=SUMPRODUCT(MAX((AD1:AD1000="Furniture")*(AP1:AP1000)))
 
Upvote 0

Forum statistics

Threads
1,215,327
Messages
6,124,294
Members
449,149
Latest member
mwdbActuary

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