Median IF returns #NUM! when criteria are not met instead of blank or 0

ech1982

New Member
Joined
Mar 26, 2018
Messages
6
I am trying to calculate a median based on several criteria. The formula works fine when the criteria are all met, but when they are not I get #NUM !. I would rather it returned a blank or a 0.




Here's the formula I'm using:
{=MEDIAN(IF(Results[Rider]=[@Rider],IF(Results[Event_Type]="CDM",Results[Rank],"")))}


In some cases there is no "CDM" result and that's where I get the error. It doesn't seem to make a difference whether I include ,"" for a false.
Any help, greatly appreciated.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Try putting IFERROR around it:

=IFERROR(MEDIAN(IF(Results[Rider]=[@Rider],IF(Results[Event_Type]="CDM",Results[Rank],""))),"")
 
Upvote 0
That worked perfectly. Thanks so much Eric W
SOLVED!


As a follow up question, I would like to find the median within the same range but where two criteria are both met within the same array.

Original formula:
{=IFERROR(ROUNDUP(MEDIAN(IF(Results[Rider]=[@Rider],IF(Results[Event_Type]="CDM",Results[Rank],""))),0),"0")}

Formula with additional Event Type of 'CM':
=IFERROR(ROUNDUP(MEDIAN(IF(Results[Rider]=[@Rider],IF(Results[Event_Type]="CDM",Results[Rank],IF(Results[Event_Type]="CM",Results[Rank],""))),0),"0")

I would like to find the median from the combined results from CDM and CM (in some cases there will be one but not the other and in some case no result at all) but this formula as well using an IF(AND or and IF(OR seem to produce the incorrect result.
Thanks
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,155
Members
453,021
Latest member
Justyna P

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