How to calculate the median in Google Sheets
Proficiency in calculating the median is crucial for those involved in number and data manipulation using Google Sheets. Serving as a measure of central tendency, the median identifies the midpoint within a dataset. Its resilience to extreme values or outliers distinguishes it from the mean, making it a reliable tool for data analysis. The MEDIAN function automatically sorts the dataset.
To calculate the median accurately, the dataset should be sorted in ascending or descending order. Sorting the data allows us to identify the middle value or the average of the two middle values, depending on whether the dataset has an odd or even number of elements. For example, consider a dataset such as 10, 20, 30, 40, 50. In this case, the median is 30. Alternatively, for a dataset such as 5, 10, 15, 20, the median is calculated as (10 + 15) / 2, resulting in 12.5.
Syntax
The basic syntax for the MEDIAN function is as follows:
=MEDIAN(number1, number2,...)
Here, number1 and number2 represent the cell number or any numeric value. It’s worth noting that we have the flexibility to include additional cells as needed.
Note: Ranges or cell references may be used instead of explicit values.
Simple values
If we simply want to find out the median between 10, 20, and 30, we'll use the MEDIAN function using the formula given below:
=MEDIAN(10,20,30)
List of cells
If we want to find MEDIAN by providing the list of cells, we can use the formula given below:
=MEDIAN(A1,A2,A3)
Range of cells
If we want to find MEDIAN by providing the range of cells, we can use the formula given below:
=MEDIAN(A1:A3)
If we want to use the range of cells and want to skip a cell number, in that case, we can use the formula given below:
=MEDIAN(A1:A3,A5)
The above formula calculates the median of cells A1, A2, A3, and A5.
Steps
The following is a step-by-step guide to using the MEDIAN function:
Select the cell: Click on the cell where we want the median to appear.
Use the MEDIAN function: Type
=MEDIAN(into the selected cell.Select the range: If we want to calculate the median of the number of cells in the range A1 to A5, there are two ways to achieve the desired result:
We can enter “A1:A5” after the opening parenthesis and then close the parenthesis and press the “Enter” button. The formula should look something like this:
=MEDIAN(A1:A5).We can also enter “A1,A2,A3,A4,A5” after the opening parenthesis and then close the parenthesis and press the “Enter” button. The formula should look something like this:
=MEDIAN(A1,A2,A3,A4,A5).
Let’s now apply the above steps to our dataset. Let’s suppose we have the following dataset:
Now, our objective is to determine the median of the marks a student gets in the required dataset. We have seen two ways to calculate the median. Let’s use both ways:
Calculating the median with a list of cells
First, we select the cell where we need to calculate the median. Let’s suppose here the cell number is B9. Then, we select the “cell(B9)” and write the following in the cell:
=MEDIAN(B3,B4,B5,B6,B7)
Let’s visualize the above steps in action:
Note: As you can see in the above slide, when multiple cells are added, the system automatically highlights the cell number and alters its color for easier identification.
If an empty cell is included in a median formula and subsequently populated with a value, the value in cell B9, where the median is calculated, will automatically update to reflect the new value.
Calculating the median by specifying the range
First, we select the cell where we need to calculate the median. Let’s suppose here the cell number is B9. Then we select the “cell(B9)” and write the following in the cell:
=MEDIAN(B3:B7)
Let’s visualize the above steps in action:
Note: If you want to skip any subject, let’s say “Geography,” you can simply write the range formula as follows:
=MEDIAN(B3:B5,B7)
Things to remember
If we try to find the median of any value (other than numbers) enclosed in double quotes, it will throw a
#VALUE!error.Empty cells, text, the logical values
TRUEandFALSE, and text values are all ignored when used with a range or by typing the cell numbers.
Unlock your potential: Google Sheets fundamentals series, all in one place!
To deepen your understanding of Google Sheets, explore our series of Answers below:
Common aggregate functions in Google Sheets
Learn about essential aggregate functions like SUM, AVERAGE, MIN, MAX, COUNT, and more for efficient data analysis.How to calculate the minimum in Google Sheets
Discover how to find the smallest value in a dataset using theMINfunction.How to calculate the median in Google Sheets
Learn how to determine the middle value of a dataset using theMEDIANfunction.How to calculate the maximum in Google Sheets
Explore how to identify the largest value in a dataset using theMAXfunction.How to calculate the average in Google Sheets
Understand how to compute the mean of a dataset using theAVERAGEfunction.How to calculate student grades from percentages in Google Sheets
Learn how to use formulas and conditional formatting to convert percentages into letter grades.How to count values in Google Sheets
Discover how to count the number of values in a range using functions likeCOUNT,COUNTA, andCOUNTIF.How to calculate the sum in Google Sheets
Explore how to add up values in a dataset using theSUMfunction.How to calculate the mode in Google Sheets
Learn how to find the most frequently occurring value in a dataset using theMODEfunction.How to calculate the product in Google Sheets
Understand how to multiply values in a dataset using thePRODUCTfunction.
Free Resources