Using OR in an array to calculate percentile

johnny_trauma

New Member
Joined
Sep 12, 2006
Messages
14
I can't seem to stay off this board today.

I thought I had figured out this problem, but to my dismay I was grossly mistaken.

I have a formula used to calculate the percentile when two conditions are met, and I am now trying to edit it to contain a third condition. The catch is that either the second or third condition must be true, not both.

My current formula looks like this:

=percentile(if(rangeA=x,if(rangeB=y,rangeD)),0.25)

but I need to add ...if(rangeB=y or rangeC=z,rangeD)...

Any suggestions?
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

NBVC

Well-known Member
Joined
Aug 31, 2005
Messages
5,828
Try:

=percentile(if(rangeA=x,if(or(rangeB=y,rangeC=z),rangeD)),0.25)
 

johnny_trauma

New Member
Joined
Sep 12, 2006
Messages
14
I've tried this formula, and the numbers just don't seem to be adding up. It appears that the formula is only taking into account the first condition when coming up with the result.

Everything with rangeA=x is being used in the calculation. Do this make any sense?
 

johnny_trauma

New Member
Joined
Sep 12, 2006
Messages
14
Ah-ha. I can't use text in the array, or the OR function will ignore them.

Any thoughts on eliminating this problem, short of transforming the text values (it is a very limited number of values) into some sort of numerical representation?
 

NBVC

Well-known Member
Joined
Aug 31, 2005
Messages
5,828

ADVERTISEMENT

What are x, y and z? Are they named cells?

If not,

=percentile(if(rangeA="x",if(or(rangeB="y",rangeC="z"),rangeD)),0.25)

Also you don't have any "False" qualifiers...what happens if Range A is not x, y or z?
 

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
19,726
Try...

=percentile(if(rangeA=x,if((rangeB=y)+(rangeC=z),rangeD)),0.25)

Hope this helps!
 

Forum statistics

Threads
1,141,681
Messages
5,707,792
Members
421,527
Latest member
Tamiwsw

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
Top