The median is the middle value in a sorted list of numbers, and in Excel you can calculate it instantly using the MEDIAN function. No sorting or manual counting is needed—just enter the function with your data range, and Excel handles the rest. This works in all modern Excel versions (2010 through 2024, Microsoft 365) on both Windows and Mac.

What You'll Need

  • Excel installed (Microsoft 365, Excel 2021, 2019, 2016, 2013, or 2010)
  • A dataset in a single column or row (though non-contiguous ranges work too)
  • Numbers only—text, logical values (TRUE/FALSE), or empty cells may be ignored depending on context

Step-by-Step

  1. Open your Excel workbook and ensure your data is entered in a single column (e.g., A1:A20) or row (e.g., A1:E1). Avoid mixing numbers with text in the same range.
  2. Click the cell where you want the median result to appear (e.g., B2).
  3. Type =MEDIAN( directly into the formula bar—or start typing =MED and select MEDIAN from the auto-suggested function list.
  4. Select your data range by clicking and dragging across the cells (e.g., A1:A20), or type the range manually (e.g., A1:A20). You can also hold Ctrl (Windows) or Command (Mac) and click multiple non-adjacent ranges like A1:A10,C1:C10.
  5. Close the parentheses with ) and press Enter. The median value appears in the cell, and the formula bar shows the complete formula (e.g., =MEDIAN(A1:A20)).

Common Mistakes

  • Including text or errors: If your range contains text (e.g., "N/A" or "Error"), the MEDIAN function ignores those cells—but if the cell contains a logical value like TRUE typed directly, it’s treated as 1; if entered via formula (e.g., =TRUE), it’s ignored. Use ISNUMBER or filtering to clean data first.
  • Accidentally including headers: If your range starts at A1 but A1 is a label like "Sales", Excel includes it, which distorts the median. Start at A2 if A1 is a header, or use =MEDIAN(A2:A21).
  • Using the wrong function: Confusing MEDIAN with AVERAGE (mean) or MODE (most frequent value). Median is robust against outliers—ideal for skewed data like income or home prices.
  • Missing or extra parentheses: Typing =MEDIAN A1:A20 or =MEDIAN((A1:A20)) triggers a #NAME? or #VALUE! error. Always verify parentheses match.

Tips

  • Use named ranges: Select your data, go to the Formula bar’s Name Box (left of the formula bar), type "SalesData", and press Enter. Then use =MEDIAN(SalesData) for clarity and easier updates.
  • Combine with filtering: If you’ve filtered data (e.g., showing only Q1 sales), MEDIAN still calculates across all rows—including hidden ones. To calculate median of only visible cells, use =AGGREGATE(12,3,A1:A20) (12 is the median code for AGGREGATE).
  • Handle large datasets: For ranges with 10,000+ rows, MEDIAN remains efficient. Just avoid referencing entire columns (e.g., A:A) unless necessary—it slows recalculation.
  • Check for even vs. odd counts: With an even number of values, Excel averages the two middle numbers (e.g., for 2,4,6,8 → median = (4+6)/2 = 5). You can verify this manually: sort the data, count rows, and find the middle two.

Troubleshooting

If the median doesn’t appear or shows an error, follow these checks:

  • #NAME? error: Usually means Excel doesn’t recognize the function. Ensure you’re using MEDIAN (not "MEDIAN" in quotes or misspelled like "MEDN"), and that Excel is updated. In older Excel versions (pre-2007), MEDIAN is available by default—no add-ins needed.
  • #NUM! error: Rare for MEDIAN, but can occur if your range contains only non-numeric data (e.g., all text). Clean your data: select the range, go to Home > Editing > Find & Select > Go To Special > Constants > Numbers only, then review.
  • #DIV/0! error: Not typical for MEDIAN, but if present, check for circular references or external links to broken workbooks. Go to Formulas > Error Checking.
  • Wrong value returned: First, verify your range. Did you include negative numbers? Excel sorts them correctly (e.g., -5, -1, 2, 10), so the median accounts for order. Second, check for hidden rows/columns—if you used filters, switch to AGGREGATE as noted in Tips.
  • Formula appears as text: If you see =MEDIAN(A1:A10) literally instead of the result, the cell may be formatted as Text. Right-click the cell > Format Cells > Number > General, then re-enter the formula.

Frequently Asked Questions

Does Excel’s MEDIAN function handle empty cells?

Yes—empty cells are ignored completely. Only numeric values are included in the calculation.

What if my dataset has an odd number of values?

The median is simply the middle number after sorting. For example, with values 3, 7, 12, 15, 20 (5 numbers), the median is 12.

Can I use MEDIAN with criteria (like MEDIANIF)?

Excel has no built-in MEDIANIF function. To calculate median with conditions, use an array formula like =MEDIAN(IF(A1:A20="Apples",B1:B20)), then press Ctrl+Shift+Enter (in older Excel) or just Enter (Microsoft 365 supports dynamic arrays). Alternatively, use =AGGREGATE(12,6,B1:B20/(A1:A20="Apples")).

Does MEDIAN work with filtered data?

Yes, but it includes hidden rows. To calculate median only for visible (filtered) cells, use =AGGREGATE(12,3,range) where 12 specifies median and 3 ignores hidden rows.

How does MEDIAN differ from AVERAGE?

AVERAGE sums all numbers and divides by count, so it’s pulled by extreme values (outliers). MEDIAN finds the middle value, making it more reliable for skewed distributions (e.g., household income where a few high values distort the mean).

Can I calculate median across multiple sheets?

Yes—reference ranges across sheets using 3D syntax. For example, =MEDIAN(Sheet1:Sheet3!A1:A10) calculates median across cells A1 to A10 in all sheets from Sheet1 to Sheet3. Ensure those sheets exist and contain numeric data.