Written by Allen Wyatt (last updated August 26, 2022)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365
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))
When you enter this as an array formula (by using Ctrl+Shift+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, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Median of Selected Numbers.
Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!
The VLOOKUP function, like other lookup functions in Excel, is not case sensitive. In other words, it doesn't matter ...
Discover MoreThe DSUM function is very handy when you need to calculate a sum based on data that matches criteria you specify. If you ...
Discover MoreNeed to find the absolute value of a number? That's where the ABS function comes into play.
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2018-10-13 08:16:31
Alex B
Another option might be to use set up the column as a filtered list or table and use the aggregate formula with a filter to limit what you want included in the median calculation
eg =aggregate(12,5,$a$1:$a$3000) where 12=median and 5=ignore hidden rows
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 © 2023 Sharon Parq Associates, Inc.
Comments