Skip to main content

How to Find Median in Excel: The Easy Way and the Long Way

Learn how to use Excel’s MEDIAN() function to find the middle value in a dataset. Compare it with AVERAGE(), handle common quirks, and apply it your own work.
Jul 16, 2025  · 5 min read

If you need to pinpoint the middle value in any list or vector, and if you’re working with a skewed distribution or if you need a non-parametric statistic for some other reason, you can use the very aptly named MEDIAN() function in Excel. Keep reading, and I’ll show you how it works.

What Does Excel MEDIAN() Do?

Let’s me clarify exactly what MEDIAN() is/offers and why it’s useful. 

While measures like the mean can be thrown off by unusually high or low values, MEDIAN() gives you the number that sits in the center of your dataset in a way that is robust against outliers. This is why the median is reported for things like housing prices. 

When you arrange your numbers from smallest to largest, MEDIAN() picks the one in the middle. (And if you have an even count, it averages the two central numbers.)

Excel MEDIAN() Syntax and Arguments

The MEDIAN() syntax is relatively straightforward:

=MEDIAN(number1, [number2], ...)

number1, number2, ...: You can enter individual numbers, cell references, or entire ranges. 

You only need one argument to get started (it wouldn’t make a whole lot of sense to find the median of a vector with one number (the median of five, for example, if five)) but you can include as many arguments you need. 

If you’re wondering, MEDIAN() will automatically skip over empty cells and ignore any text, so you don’t need to worry about cleaning up your data beforehand. In other words, if you have a lot of blank cells, it would not add a bunch of zeros.

A Quick Example: Excel MEDIAN() in Action

Imagine you have a list of exam scores in cells A2 through A6:

How to find the median in Excel

To find the median score in this group, simply use:

=MEDIAN(A2:A6)

This is probably the most common kind of use case, where you input a range into the function.

Here’s how Excel is working through it: Excel first sorts the values so it looks like this: 78, 85, 88, 90, 92, and then it returns 88, which the value in the middle. 

How Excel MEDIAN() Handles Even and Odd Numbers

MEDIAN() adapts when your dataset has an even or odd number of entries. This is important because the function’s behavior changes slightly depending on the count:

  • Odd number of values: MEDIAN() returns the single center value.

  • Even number of values: MEDIAN() averages the two middle numbers.

Suppose you add another score—say, 94 in cell A7:

How to find the median in Excel with odd number of items

Now, enter:

=MEDIAN(A2:A7)

Excel sorts the scores as (78, 85, 88, 90, 92, 94). The two middle values are 88 and 90. MEDIAN() averages these and gives you 89. 

Excel MEDIAN() with Multiple Ranges or Numbers

MEDIAN() also handles more complex situations. It can accept multiple ranges, or a mix of ranges and individual numbers.

=MEDIAN(A2:A6, B2:B6, 100)

This formula takes all the numbers from A2:A6, all from B2:B6, and adds the value 100 into the mix, then finds the median of everything. So you don’t have to arrange all your numbers in one row or column before using the function. 

Finding the MEDIAN() Date

Excel treats dates as serial numbers, so MEDIAN() can find the “middle” date. This is a useful trick for project timelines.

Excel MEDIAN works with dates

How MEDIAN() Handles Text, Empty Cells, and Errors

You’re going to encounter cells that are empty, contain text, or logical values. It’s important to know how MEDIAN() reacts with these cates:

  • Empty cells: Ignored completely. I mentioned this earlier.

  • Text: Skipped if it appears in a referenced cell or range. However, if you type text directly into the formula (like =MEDIAN("apple", 10)), Excel will return a #VALUE! error, so don’t do this.

  • Logical values (TRUE, FALSE): If included as part of a range, they’re ignored. If you type them directly as arguments, TRUE counts as 1 and FALSE as 0.

What If There Were No MEDIAN() Function?

You could find the median without the MEDIAN() function. I’ll show you how, if you’re curious, but I don’t recommend it because, as you will see, it’s too much work.

First, count how many numbers you have with =COUNTA(). Then, get the position of the middle value with ROUNDUP(). Then, extract that value with SMALL(). Your formula might look like this:

=SMALL(A2:A6, ROUNDUP(COUNTA(A2:A6)/2, 0))

This works when there’s an odd number of values. For even counts, you can average two SMALL() calls:

=(SMALL(A2:A7, COUNTA(A2:A7)/2) + SMALL(A2:A7, COUNTA(A2:A7)/2 + 1)) / 2

As you can see, it gets the same answer. But save yourself the trouble and use MEDIAN())

Finding the median in Excel using COUNTA, ROUNDUP and SMALL

Common Mistakes

The following things can trip you up:

  • Including text directly: Typing =MEDIAN(10, "apple", 20) produces a dreaded #VALUE! error.

  • Mixing ranges of different sizes: MEDIAN() simply combines all the numbers; the size or shape of each range doesn’t matter.

Combining MEDIAN() with Other Functions

You can combine MEDIAN() with IF() to find the median of values that meet a condition. Do this with an array formula. For example, to calculate the median of scores above 80:

=MEDIAN(IF(A2:A10>80, A2:A10))

You may also combine MEDIAN() with FILTER()

=MEDIAN(FILTER(A2:A10, A2:A10>80))

These approaches let you zero in on specific subsets of your data, giving you a more targeted result.

Conclusion

Remember that MEDIAN()skips blanks, ignores text, and gives you a good idea of the middle value no matter the shape of your dataset. It’s good for those scenarios where outliers might throw off the average, like income distributions, as I mentioned, or project durations.

If you want to keep building your Excel skills, take a look at our Data Analysis in Excel course, where you'll learn about other summary stats and then learn those analysis techniques that drive better decisions (and will impress your boss).

Advance Your Career with Excel

Gain the skills to maximize Excel—no experience required.

Start Today for Free

Josef Waples's photo
Author
Josef Waples

I'm a data science writer and editor with contributions to research articles in scientific journals. I'm especially interested in linear algebra, statistics, R, and the like. I also play a fair amount of chess! 

FAQs

What happens if all values are the same?

MEDIAN() will just return that value. No surprises there.

Can I use MEDIAN() horizontally / across a row?

Yes, definitely. Just select the row’s cells, like =MEDIAN(B2:F2).

Does MEDIAN() work with non-numeric data?

No. It skips text and empty cells in ranges, but will throw an error if you enter text directly.

Topics

Learn Excel with DataCamp

Course

Data Analysis in Excel

3 hr
107.9K
Learn how to analyze data with PivotTables and intermediate logical functions before moving on to tools such as what-if analysis and forecasting.
See DetailsRight Arrow
Start Course
See MoreRight Arrow
Related

Tutorial

AVERAGE() in Excel: An Essential Function Explained

Learn to work with Excel’s AVERAGE() function, including conditional and logical variations.
Josef Waples's photo

Josef Waples

Tutorial

R median() Function: Find the Middle Value

Learn how to quickly find the middle value of your data using the R median() function. Discover tips for handling missing values and grouping data by categories.
Josef Waples's photo

Josef Waples

Tutorial

Mean vs. Median: Knowing the Difference

Explore the differences between mean and median, learn their applications in data analysis, and know how to choose the right measure for different scenarios.
Samuel Shaibu's photo

Samuel Shaibu

Tutorial

Rank Formula in Excel: A Comprehensive Guide With Examples

Learn how to rank data in Excel with RANK(), RANK.EQ(), and RANK.AVG() functions. Understand their differences, applications, and tips for accurate data analysis.
Laiba Siddiqui's photo

Laiba Siddiqui

Tutorial

How to Divide in Excel: A Beginner-Friendly Breakdown

Learn how to divide numbers, cells, and columns in Excel using simple formulas and tools. Discover how to handle errors, use functions like QUOTIENT and MOD, and ensure results sum to whole numbers when needed.
Laiba Siddiqui's photo

Laiba Siddiqui

Tutorial

Excel MATCH() Function: How to Find the Position of a Value in a Range

Learn how to use the MATCH() function in Excel to locate the position of a value within a range, including its syntax, use cases, and advanced techniques.
Laiba Siddiqui's photo

Laiba Siddiqui

See MoreSee More