Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Median of Selected Numbers.
Written by Allen Wyatt (last updated December 2, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021
William is trying to find the median of about 3,000 numbers in a column that has a range from 0.9 to 5. However, he only wants the median of numbers that are greater than 1. He can't figure out how to put that parameter into his formula and is looking for ideas.
Short of creating a user-defined function in a macro, there are a couple of ways you can go about determining the median. One method is to use an intermediate column that contains only those values above 1 and then calculate the median based on those values. You could also use an advanced filter to extract only the values above 1 and then use those values to find the median.
A better approach, however, is to use a simple array formula:
=MEDIAN(IF($A$1:$A$3000>1,A1:A3000))
In earlier versions of Excel you'll need to enter this as an array formula by using Ctrl+Shift+Enter. (In Microsoft 365 or Excel 2021 you can just press Enter.) The result is your median value, with your criteria taken into account.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (7922) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Excel here: Median of Selected Numbers.
Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!
The SUMIF function is supposed to work just fine doing comparisons with text values. This isn't a hard-and-fast rule, ...
Discover MoreNormally the VLOOKUP function returns a value, and if it can't return a value it returns a zero. Here's how you can use ...
Discover MoreNeed to find the lowest numbers in a range of values? It's easy to do using the SMALL worksheet function, or you can use ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2023-12-03 10:57:08
J. Woolley
The Tip's formula works because MEDIAN ignores text, logical values, or empty cells in an array or reference argument; therefore, FALSE values in the formula's array argument are not interpreted as zero values. Notice this formula would produce a different result because FALSE is replaced by zero:
=MEDIAN(IF($A$1:$A$3000>1,A1:A3000,0))
(It should also be noted that logical values and text representations of numbers typed directly into MEDIAN's list of arguments are NOT ignored.)
The Tip says, "In earlier versions of Excel you'll need to enter this as an array formula by using Ctrl+Shift+Enter." I don't think this is necessary because the formula does not return an array.
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments