Google Sheets Median Function: How to Use It
In this article
To find the median in Google Sheets, use the formula =MEDIAN(value1, value2, ...) or =MEDIAN(range). The median is the middle value of a data set; if the set has an even number of values, it is the average of the two middle numbers. This function is essential for analyzing data sets where extreme outliers (very high or very low numbers) would distort a standard average.
What You'll Need
- A Google account with access to Google Sheets.
- A dataset consisting of numbers, which can be entered manually or imported from another source.
- A basic understanding of how to select cells or ranges within a spreadsheet.
Step-by-Step
- Prepare Your Data: Enter the numbers you want to analyze into a column or row. For example, if you are tracking monthly expenses, list them in cells A1 through A10. Ensure that the cells are formatted as "Number" or "Automatic" so that Google Sheets recognizes them as numeric values rather than text.
- Select the Target Cell: Click on the empty cell where you want the median result to appear. This is usually below or to the right of your data range.
- Enter the Equals Sign: Type
=into the cell. This tells Google Sheets that you are starting a formula rather than entering plain text. - Type the Function Name: Type
MEDIANfollowed by an open parenthesis(. Your cell should now look like this:=MEDIAN(. - Define the Range: You have two options here:
- Click and Drag: While the parenthesis is open, click the first cell of your data (e.g., A1) and drag your mouse down to the last cell (e.g., A10). Google Sheets will automatically fill in
A1:A10. - Manual Entry: Type the range manually, such as
A1:A10.
- Click and Drag: While the parenthesis is open, click the first cell of your data (e.g., A1) and drag your mouse down to the last cell (e.g., A10). Google Sheets will automatically fill in
- Close the Parenthesis and Execute: Type the closing parenthesis
)and press the Enter key on your keyboard. - Verify the Result: The cell will now display the median value. If you change any of the numbers in your original range, the median will automatically update to reflect the new middle value.
Common Mistakes
One of the most frequent errors is including non-numeric data within the range. If your range includes a header (like the word "Price") or empty cells that contain hidden spaces, Google Sheets generally ignores these, but if the cells contain text that looks like a number but is formatted as text, the function may not count them, leading to an inaccurate median.
Another common mistake is confusing the Median with the Mean (Average). Users often use =AVERAGE() when they actually need =MEDIAN(). For instance, if you have five salaries: $30k, $32k, $35k, $38k, and $500k, the average is $127k, which does not represent the typical employee. The median is $35k, providing a much more accurate picture of the "middle" of the group.
Users also sometimes forget to close the parenthesis or accidentally include the cell where the formula is located inside the range. For example, if you put the formula in cell A11 and set the range to A1:A11, you create a circular dependency error because the formula is trying to calculate a median that includes its own result.
Tips
Combining Multiple Ranges: You are not limited to a single contiguous block of cells. You can find the median of several different areas by separating them with commas. For example, =MEDIAN(A1:A10, C1:C10, E5) will calculate the median across all those specified cells combined.
Using Median with Filtered Data: The standard MEDIAN function calculates the middle value of all cells in the range, even those hidden by a filter. If you only want the median of the visible rows after applying a filter, you will need to combine the function with SUBTOTAL or use a FILTER function inside the median formula, such as =MEDIAN(FILTER(A1:A10, B1:B10="Complete")).
Handling Outliers: When preparing your data, use the median specifically when you suspect your data is skewed. In real estate or income reporting, the median is the gold standard because a single multi-million dollar mansion in a neighborhood of modest homes would pull the average price up significantly, whereas the median remains stable.
Dynamic Ranges: If you are constantly adding new data to the bottom of a list, use an open-ended range. Instead of A1:A10, use A1:A. This tells Google Sheets to look at every single cell from A1 to the very bottom of the sheet, ensuring your median stays current as you add new rows.
Troubleshooting
If your formula is not working as expected, start with these checks:
The #VALUE! Error: This typically occurs if the formula cannot find any numeric data to process. Check your cells to ensure the numbers aren't being treated as text. A quick way to check is to see if the numbers are aligned to the left (text) or right (numbers) of the cell by default. To fix this, select the range and go to Format > Number > Number.
The #REF! Error: This usually means a circular dependency. Check your range to ensure the cell containing the =MEDIAN formula is not part of the range being calculated. If the formula is in cell B1, the range should be something like A1:A10, not A1:B1.
Unexpected Result: If the number seems wrong, check for hidden rows or filtered data. Remember that MEDIAN includes hidden rows. If you have manually hidden rows that contain very large or small numbers, they are still influencing the result. To fix this, either delete the unnecessary data or use the FILTER function mentioned in the Tips section.
Formula Not Calculating: If you see the text =MEDIAN(A1:A10) in the cell instead of a number, the cell is likely formatted as "Plain Text." Change the formatting to "Automatic" via the Format menu and then double-click the cell and press Enter to trigger the calculation.
Frequently Asked Questions
How does the median differ from the average?
The average (mean) adds all numbers and divides by the count. The median finds the exact middle point of the list. The median is better for data with extreme outliers.
What happens if there is an even number of values?
If the dataset has an even number of entries, Google Sheets takes the two middlemost numbers and calculates their average to determine the median.
Can I find the median of non-adjacent cells?
Yes. You can list individual cells or multiple ranges separated by commas inside the parentheses, such as =MEDIAN(A1, B5, C10:C15).
Does the MEDIAN function ignore blank cells?
Yes, the MEDIAN function ignores empty cells and cells containing text. It only considers numeric values in its calculation.
Can I use the median function across different sheets?
Yes. You can reference another sheet by including the sheet name followed by an exclamation point, for example: =MEDIAN('Sheet2'!A1:A100).
Is there a way to find the median based on a condition?
There is no built-in "MEDIANIF" function. To achieve this, you must wrap a FILTER function inside the median function, like =MEDIAN(FILTER(range, condition)).