Median formula to ignore blank cells

Hanz77

Board Regular
Joined
Sep 21, 2006
Messages
87
I'm trying to find the median on a range of numbers; however, the data is downloaded from another source and has the occasional blank cell. The Median formula automatically counts these blanks as zeros and skews my results. Following is my current formula and an example of the data I am using.

{=MEDIAN(IF(A1:A2000=15,B1:B2000))}

Column A contains random numbers ranging from 1 to 20. I am trying to get the median of all numbers in column B that has the number 15 in Column A. As originally stated, there are instances where there could be the number 15 in column A; however, the coresponding number in column B could be blank. I want this blank ignored and not counted as zero for my median amount. Also, I cannot delete the rows containing these blanks as there is additional data that I need in column C through M.

Any suggestions are appreciated.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
19,958
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
How about:
Code:
=MEDIAN(IF(A1:A2000=15,IF(B1:B2000<>"",B1:B2000)))

Confirm with CTRL-SHIFT-ENTER
 

Gerald Higgins

Well-known Member
Joined
Mar 26, 2007
Messages
9,116
Quick and dirty - sort your data on col B to bring all the blanks together, then modify your formula to exclude the rows containing blanks
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,095
Messages
5,768,054
Members
425,451
Latest member
JohnBrooksBiddle

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