The MEDIAN function finds the middle number in a list of values

Excel's MEDIAN function takes a set of numbers and returns the one in the middle when they are arranged from smallest to largest. If you have an even count of numbers, it returns the average of the two middle values. This is different from the AVERAGE function, which adds all numbers and divides by how many there are — the median ignores extremely high or low outliers and gives you a better sense of a typical value in many real-world situations.

The basic syntax is =MEDIAN(number1, number2, ...) or =MEDIAN(range). You can type individual numbers separated by commas, or point to a range of cells. Excel will do the sorting and calculation for you.

Key Takeaways

  • Type =MEDIAN() in a cell, then either list numbers separated by commas or select a range of cells containing your data.
  • The median is the middle value when numbers are sorted from smallest to largest, making it useful when a few very large or very small numbers would skew an average.
  • If your data has an even number of values, Excel returns the average of the two middle numbers.
  • You can use MEDIAN on a single column, a single row, or a rectangular range of cells all at once.

Entering MEDIAN with individual numbers

Click the cell where you want the result to appear. Type =MEDIAN( and then type your numbers separated by commas. For example, =MEDIAN(5, 12, 8, 3, 15) will return 8, because when sorted the numbers are 3, 5, 8, 12, 15 and 8 is in the middle. Close with a closing parenthesis and press Enter.

This method works when you have only a few numbers or when your numbers are not already in cells. For larger datasets, selecting a range is faster and less error-prone.

Using MEDIAN with a range of cells

If your numbers are already in cells — say, in column A from row 2 to row 20 — click the cell where you want the result. Type =MEDIAN(A2:A20) and press Enter. Excel will look at every cell in that range, sort the values, and return the middle one.

You can also select the range by clicking and dragging. Type =MEDIAN( then click the first cell you want to include, hold down the mouse button, and drag to the last cell. Excel will fill in the range reference for you. Then type the closing parenthesis and press Enter.

MEDIAN with multiple columns or non-contiguous cells

If your data is spread across multiple columns or in cells that are not next to each other, you can include multiple ranges in one MEDIAN formula. Type =MEDIAN(A2:A10, C2:C10) to find the median of both column A and column C together. Excel treats all the values as one combined list.

For cells that are not in a continuous range, separate each cell or range with a comma. For example, =MEDIAN(A2, A5, A8, B3:B7) will find the median of cells A2, A5, A8, and the range B3 through B7 all together.

Understanding the result when you have an even number of values

If your list has an even count of numbers, there is no single middle value. Excel returns the average of the two middle numbers. For example, if you have 4, 7, 9, 12, the two middle values are 7 and 9. The MEDIAN function returns 8 (which is 7 + 9 divided by 2).

This behavior is standard in statistics and is usually what you want. If you need to see the actual middle values instead of their average, you would need to sort your data manually or use other functions like SMALL or LARGE to extract specific positions.

When to use MEDIAN instead of AVERAGE

Use MEDIAN when a few extreme values would distort your picture. Imagine you are looking at house prices in a neighborhood: $250,000, $265,000, $270,000, $280,000, and $2,500,000. The average is $673,000, which does not represent a typical house. The median is $270,000, which is much more realistic.

MEDIAN is also useful for test scores, salaries, or any data where outliers exist. AVERAGE is better when you need the total divided evenly — for example, splitting a restaurant bill or calculating total hours worked divided by number of employees.

Common mistakes and how to avoid them

The most common error is including text or empty cells in your range. Excel ignores empty cells and text, so they will not throw an error, but they can give you unexpected results if you are not paying attention. If a cell contains a label like "Price" instead of a number, MEDIAN skips it silently.

Another mistake is forgetting the equals sign at the start. Excel will not recognize =MEDIAN as a formula without it — it will just display the text. Also, make sure your range reference uses a colon (A2:A10) not a comma (A2,A10) when you mean a continuous block of cells. A comma means two separate items, while a colon means everything in between.

Frequently Asked Questions

Can I use MEDIAN on cells that contain formulas?

Yes. MEDIAN looks at the result of the formula in each cell, not the formula itself. If cell A2 contains =B2*2, MEDIAN will use the calculated value, not the formula text.

What happens if all my numbers are the same?

MEDIAN returns that number. If every cell contains 5, the median is 5. This is correct — the middle value of identical numbers is that number itself.

Can MEDIAN work with negative numbers?

Yes. MEDIAN treats negative numbers the same as positive ones. It sorts them from smallest to largest (so negative numbers come first) and finds the middle value. For example, MEDIAN(-10, -5, 0, 5, 10) returns 0.

Does MEDIAN work across different sheets?

Yes. You can reference cells from another sheet by typing the sheet name followed by an exclamation mark and the cell reference. For example, =MEDIAN(Sheet2!A2:A10) will find the median of cells A2 through A10 on Sheet2.

What if I have a very large dataset — will MEDIAN slow down my spreadsheet?

MEDIAN is efficient even with thousands of rows. It may take a moment to recalculate if you have many formulas across your entire sheet, but MEDIAN itself is not a performance bottleneck. If your spreadsheet is slow, the issue is usually elsewhere.