How to Find the Median in Excel: Step-by-Step
In this article
The median is the middle value in a list of numbers when they are sorted from smallest to largest. In Excel, you get it with the MEDIAN function: type =MEDIAN(range) into an empty cell, replacing range with your actual data range (for example =MEDIAN(A2:A20)), and press Enter. That returns the median of those cells instantly, ignoring blanks and text. This guide walks through the exact steps, the common ways it goes wrong, and how to fix them.
What You'll Need
- Excel on Windows, Mac, or the web (the MEDIAN function works the same in all versions).
- Your numbers entered in a column or row, ideally with a header row so the range is easy to read.
- An empty cell to hold the result.
Step-by-Step
- Click an empty cell where you want the median to appear. A blank cell below or beside your data is typical.
- Type
=MEDIAN(to start the formula. Excel will show a tooltip with the function's syntax. - Select your data range with the mouse, or type it directly. For example, if your numbers are in cells A2 through A20, the formula becomes
=MEDIAN(A2:A20). You can also select non-adjacent cells by holding Ctrl (Windows) or Command (Mac) and clicking each one, separating them with commas:=MEDIAN(A2,A5,A9). - Close the parenthesis by typing
)and press Enter. The cell now shows the median value. - Verify the result by checking a small sample. For example, if your range is 1, 2, 3, 4, 5, the median should be 3. If it is not, see Troubleshooting below.
- Format the result if needed. Select the cell, then use the Number Format dropdown on the Home tab to set decimal places or currency. The median itself is a plain number; formatting only changes how it looks.
Note: menu labels and the exact location of the formula bar can differ slightly between Excel versions, platforms, and regions. The function name and syntax are the same everywhere.
Common Mistakes
- Including text or blank cells in the range. MEDIAN ignores text and blanks automatically, so this is usually safe, but if your range includes error values like #N/A, the result will also be an error. Clean the data first.
- Using AVERAGE instead of MEDIAN. AVERAGE returns the mean, which is pulled by very large or small numbers. MEDIAN gives the middle value and is more robust for skewed data.
- Forgetting to sort. You do not need to sort the data for MEDIAN to work; Excel sorts internally. Sorting is only for your own visual check.
- Typing the range with a space instead of a colon.
A2 A20is not a range; useA2:A20. - Expecting MEDIAN to work on filtered rows. MEDIAN includes hidden or filtered-out rows. If you need the median of only visible rows, use the SUBTOTAL function with function number 101 (for example
=SUBTOTAL(101,A2:A20)), which ignores manually hidden rows but not filtered rows in all versions; check your Excel version's behavior.
Tips
- Use a named range (Formulas > Define Name) to make formulas easier to read, e.g.
=MEDIAN(Sales). - To find the median of an entire column excluding the header, use
=MEDIAN(A:A)only if the header is text; MEDIAN ignores text. If the header is a number, exclude it explicitly. - Press Ctrl+` (grave accent) to toggle showing formulas instead of results, which helps you audit a sheet.
- For a quick visual, insert a chart and add a median line using a helper column, but that is optional.
Troubleshooting
If the formula returns an error or an unexpected value, work through these checks in order:
- #VALUE! or #N/A: Your range contains an error value or a cell that Excel cannot interpret as a number. Remove or correct the error cells, or use
AGGREGATEwith option 6 to ignore errors:=AGGREGATE(16,6,A2:A20)(16 is the MEDIAN function number in AGGREGATE). - Result looks wrong: Confirm the range covers only the intended cells. Click the cell with the formula and check the highlighted range on the sheet.
- Formula shows as text: The cell may be formatted as Text. Change the format to General (Home > Number Format) and re-enter the formula.
- MEDIAN returns a number but you expected a different one: Remember that for an even count of numbers, Excel returns the average of the two middle values. For example, the median of 1, 2, 3, 4 is 2.5.
- Nothing happens when you press Enter: Check that you are not in Edit mode with a cell reference selected; press Esc and start again.
If none of these fix it, try the formula in a new blank workbook with a few test numbers to confirm Excel itself is working, then compare.
Frequently Asked Questions
Does MEDIAN work on non-adjacent cells?
Yes. Separate each cell or range with a comma inside the parentheses, for example =MEDIAN(A1,A3,A5).
What happens if my range has an even number of values?
Excel returns the average of the two middle numbers. For 1, 2, 3, 4 the result is 2.5.
Can I use MEDIAN with conditions, like only values above 10?
MEDIAN itself has no criteria argument. Use an array formula or the newer MEDIAN(IF(range>10,range)) entered with Ctrl+Shift+Enter in older Excel, or use MEDIAN(FILTER(range,range>10)) in Excel 365 and Excel 2021 where FILTER is available.
Does MEDIAN ignore blank cells?
Yes, blank cells, text, and logical values are ignored. Only numbers are counted.
Why does MEDIAN give a different answer from AVERAGE?
AVERAGE adds all numbers and divides by the count; MEDIAN finds the middle position. They differ when the data is skewed by outliers.
Can I find the median of a PivotTable?
PivotTables do not offer Median as a standard summary function. You can add a helper column with the MEDIAN formula outside the PivotTable, or use Power Pivot measures if your version supports them.