Excel 2007 - can Median(IF)) be used with multi criteris - Median(if(and()))?

aaghassi

New Member
Joined
Aug 21, 2014
Messages
2
I need to find the median of data based on several pieces of criteria.
I have found that Median can be use with IF as an array formula, but i can't find anything to say that I can use several pieces of critera from various columns on the IF

Can I use Median(if(and(...,....,...,))) as an array formula in Excel 2007?

thanks
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Welcome to Mr Excel

To create an AND condition in an array formula you should multiply the conditions.

=MEDIAN(IF((range1=criteria1)*(range2=criteria2)*(range3=criteria3),somerange))
Ctrl+Shift+Enter

Hope this helps

M.
 
Last edited:
Upvote 0
AND's can be mapped onto IFs...

=MEDIAN(IF(X=x,IF(Y>y,Z)))

which says Feed the values of Z to median when the values of X equals x and the values of Y are greater than y. The upper case letters stand for equally sized multicell ranges and the lower case letters for criteria that must hold.

Note that such formulas array-processing formulas, so they need confirming with control+shift+enter, not just enter.
 
Upvote 0
Thank you Aladin and Marcelo!
Multiplying the conditions did not work quite right for my situation. Some of my data results was a zero (0) and sometimes it needed to be considered in the median and sometimes it did not. Multiplying conditions did not seem to let me limit the zeros to only the circumstances that were valid to include.

Before i received these responses, i stumbled upon another post that was similar and took pieces of it that ended up being this same nested IF idea.
The nested IF does seem to allow me to distinguish when i will consider the zero in my median and when i will not.
My Excel results are not matching someone else's SAS calculated results - so i will now try to make sure all of my conditions match theirs. Wish me luck!!!

Thank you both!!

Ann
 
Upvote 0
Thank you Aladin and Marcelo!
Multiplying the conditions did not work quite right for my situation. Some of my data results was a zero (0) and sometimes it needed to be considered in the median and sometimes it did not. Multiplying conditions did not seem to let me limit the zeros to only the circumstances that were valid to include.

Before i received these responses, i stumbled upon another post that was similar and took pieces of it that ended up being this same nested IF idea.
The nested IF does seem to allow me to distinguish when i will consider the zero in my median and when i will not.
My Excel results are not matching someone else's SAS calculated results - so i will now try to make sure all of my conditions match theirs. Wish me luck!!!

Thank you both!!

Ann

You are welcome. Unless Excel and SAS differ in how they implement MEDIAN, they should not differ qua results.
 
Upvote 0
You are welcome. Unless Excel and SAS differ in how they implement MEDIAN, they should not differ qua results.

Hi all,

I have looked through messages on the forum on Median and If functions and I cant seem to get my formula right... any help would be appreciated.

=MEDIAN(IF
((K2:K66,">=1")*(BM2:BM66,"yes"),K2:K66)

Thanks in advance
 
Upvote 0
Hi all,

I have looked through messages on the forum on Median and If functions and I cant seem to get my formula right... any help would be appreciated.

=MEDIAN(IF
((K2:K66,">=1")*(BM2:BM66,"yes"),K2:K66)

Thanks in advance

Control+shift+enter, not just enter:

=MEDIAN(IF(K2:K66 > 1, IF(BM2:BM66 = "yes", K2:K66)))
 
Upvote 0
Thanks Aladin!!!- This has helped me finally work out how to use IF functions... it seems the IF needs to be put in front of every new condition and then the range is out at the end. Cheer!!
 
Upvote 0
Thanks Aladin!!!- This has helped me finally work out how to use IF functions... it seems the IF needs to be put in front of every new condition and then the range is out at the end. Cheer!!

You are welcome. Yes regarding IF. It does effect filtering based on a condition.
 
Upvote 0

Forum statistics

Threads
1,216,028
Messages
6,128,399
Members
449,447
Latest member
M V Arun

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