Link to home
Start Free TrialLog in
Avatar of Hardly_an_Expert
Hardly_an_ExpertFlag for United States of America

asked on

Excel Percentile Calc Across Multiple columns

Hi Experts,
I have an Excel sheet where I want to look up a value and then calculate a percentile across multiple columns.  I get how to calculate a percentile across multiple columns and how to calculate a percentile based on meeting a certain criteria - but I have no idea how to combine the two.

This is difficult to explain typed out - see the attached.  I understand how to calculate G2 and G3, but G4 (which is kind of a combination of the two) is where I am stumped.  This is a simplified version, the real one has significantly more data.

Thanks in advance.
Sample.xlsm
Avatar of McOz
McOz

try:

{=PERCENTILE(IF(A2:A43="Retail",B2:D43),0.9)}

enter as an array formula. I have attached your sample file, with the fix.

good luck!
McOZ
Sample.xlsm
Avatar of barry houdini
I think you need to filter out blanks, too, otherwise both your original formula and McOz's suggestion for all three columns will count blanks as zeroes and skew the calculation.

For your basic calculation you can use all three columns in one assuming they are contiguous, i.e.

=PERCENTILE(B2:D43,0.9)

That will automatically ignore blanks but for your next calculation in G3 where you use an IF the blanks are converted to zeroes in the process so for G3 you should use

=PERCENTILE(IF(A2:A43="Retail",IF(B2:B43<>"",B2:B43)),0.9)

and then G4 is the same except the last range(s) are extended to D, i.e.

=PERCENTILE(IF(A2:A43="Retail",IF(B2:D43<>"",B2:D43)),0.9)

regards, barry
see attached example

barry
26845770.xlsx
Avatar of Hardly_an_Expert

ASKER

HI Barry and McOz,
I just had a "duh" moment in looking at your responses... unfortunately, I over simplified my example - there is actually data between the various columns which prevents me from using one big array (e.g, B2:D45).  I am pretty sure I need to look at each column individually.  The problem I am running into is referencing 3 different columns which may have many columns of both text and numbers in between.

See the new attached sample which better reflects my situation.
Sample.xlsm
ASKER CERTIFIED SOLUTION
Avatar of barry houdini
barry houdini
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Interesting approach - I can make that work.
Thanks