The MEDIAN function finds the middle value in a list of numbers
Excel's MEDIAN function calculates the middle number in a set of data — the value where half the numbers fall above it and half fall below. If you have an odd number of values, MEDIAN returns the exact middle one. If you have an even number of values, it returns the average of the two middle numbers.
The function works the same way whether your data is in a single column, a single row, or scattered across multiple cells. You type the formula, Excel does the math, and you get your answer in seconds. This is much faster than sorting data by hand and counting to the middle.
MEDIAN is useful when you want to understand a typical value without being thrown off by extremely high or low numbers. For example, if you have five salaries of $30,000, $35,000, $40,000, $45,000, and $500,000, the median is $40,000 — a better picture of the middle than the average would be.
Key Takeaways
- The MEDIAN function syntax is =MEDIAN(range) where range is the cells containing your numbers.
- You can select a continuous block of cells, multiple separate ranges, or type individual cell references separated by commas.
- MEDIAN ignores empty cells and text, so you do not have to clean your data first.
- For an even count of numbers, MEDIAN returns the average of the two middle values, not one of the actual numbers in your list.
How to enter the MEDIAN formula in a cell
Click the cell where you want the median result to appear. Type an equals sign to start the formula: =MEDIAN(. Then select the range of cells containing your numbers by clicking the first cell and dragging to the last one, or by typing the cell references directly.
For example, if your numbers are in cells A1 through A10, type =MEDIAN(A1:A10) and press Enter. Excel calculates the median and displays it in that cell. The formula bar at the top shows the formula you entered, so you can check it if the result looks wrong.
If your data is not in one continuous block, you can include multiple ranges. Type =MEDIAN(A1:A5,C1:C5) to find the median of cells A1 through A5 and C1 through C5 together. Separate each range with a comma.
Selecting your data range correctly
The most common mistake is selecting the wrong cells. Before you type the formula, count how many numbers you actually want to include. If you have headers in row 1 (like "Sales" or "Temperature"), start your range at row 2, not row 1.
If you select a range that includes text or empty cells, MEDIAN ignores them and calculates based only on the numbers it finds. This is helpful because you do not have to delete empty rows or remove labels. However, it also means you might get a result you did not expect if you accidentally included the wrong column.
A safe approach: click on the first number you want to include, hold Shift, and click on the last number. Excel highlights the entire range in blue. Then type your formula. This visual confirmation prevents you from selecting A1:A10 when you meant A2:A11.
Using MEDIAN with filtered or sorted data
MEDIAN calculates based on the actual values in the cells, not on what you see on screen. If you have sorted your data or applied a filter, MEDIAN still includes all the original numbers in your range, even the hidden ones. This is usually what you want, but it is worth knowing.
If you need the median of only the visible (filtered) cells, you cannot use MEDIAN alone. Instead, use the AGGREGATE function, which can ignore hidden rows. The formula would be =AGGREGATE(12,5,A1:A10), where 12 means median and 5 means ignore hidden rows. This is more advanced, but it solves the problem when filtering matters.
Comparing MEDIAN to AVERAGE and MODE
Excel offers three functions for finding a typical value, and they give different answers. AVERAGE adds all numbers and divides by how many there are — it is pulled higher or lower by extreme values. MEDIAN finds the middle value and ignores how far away the extremes are. MODE finds the number that appears most often in your list.
Use AVERAGE when you want the total divided equally — like splitting a restaurant bill. Use MEDIAN when you want the middle point — like describing a typical house price in a neighborhood where a few mansions skew the average way up. Use MODE when you want the most common value — like finding the most popular shoe size.
For the salary example above ($30,000, $35,000, $40,000, $45,000, $500,000), the average is $130,000, the median is $40,000, and there is no mode because no salary appears twice. The median tells you more about what a typical employee actually earns.
Troubleshooting MEDIAN results that look wrong
If your median result is a decimal number but all your data looks like whole numbers, you probably have an even count of values. MEDIAN averages the two middle numbers, which creates a decimal. For example, the median of 10, 20, 30, 40 is 25 (the average of 20 and 30). This is correct behavior.
If your result is 0 or seems far too low, check whether your range includes empty cells or cells with text. MEDIAN ignores these, so if you selected A1:A20 but only A1:A10 contain numbers, the median is based on just those 10 values. Verify your range by clicking on the cell with the formula and looking at the highlighted range in the spreadsheet.
If you see a #VALUE! error, your range probably contains text that Excel cannot convert to a number. Check for cells with labels, spaces, or special characters mixed in with your numbers. Delete or move the text, or adjust your range to exclude it.
Using MEDIAN in larger spreadsheets
In a spreadsheet with many rows of data, you can calculate a median for each group. For example, if column A contains department names and column B contains salaries, you might want the median salary for each department separately. Create a formula for each department using a range that includes only that department's rows: =MEDIAN(B2:B15) for one department, =MEDIAN(B16:B30) for another.
You can also nest MEDIAN inside other functions. For instance, =IF(MEDIAN(A1:A10)>100,"High","Low") checks whether the median is above 100 and returns text based on the result. This combines MEDIAN with logic to automate decisions based on your data.
Frequently Asked Questions
Can I use MEDIAN on data in different sheets?
Yes. Type the sheet name followed by an exclamation point and the cell range: =MEDIAN(Sheet2!A1:A10). If the sheet name contains spaces, wrap it in single quotes: =MEDIAN('Sheet 2'!A1:A10). This works the same as selecting cells on the current sheet.
What happens if I include negative numbers in my MEDIAN range?
MEDIAN treats negative numbers like any other number. If your data is -10, -5, 0, 5, 10, the median is 0. Negative values are included in the calculation and affect the result just as positive values do.
Does MEDIAN work with dates or times?
Yes, because Excel stores dates and times as numbers behind the scenes. =MEDIAN(A1:A10) on a range of dates returns the middle date. The result appears as a number, so you may need to format the cell as a date to see it correctly. Right-click the cell, choose Format Cells, and select Date.
Can I find the median of only cells that meet a certain condition?
MEDIAN alone cannot filter by condition, but you can use an array formula or a helper column. A simpler approach is to use AGGREGATE with criteria, though this requires more advanced setup. For most situations, filtering your data first and then running MEDIAN on the visible cells is the clearest method.
What is the difference between MEDIAN and PERCENTILE?
MEDIAN finds the 50th percentile — the exact middle. PERCENTILE lets you find any position: the 25th percentile (one quarter of the way up), the 75th percentile (three quarters of the way up), or any other point. Use PERCENTILE when you need more control over which position in the data you want to find.