Table of Contents
The process of calculating the median of filtered rows in Excel involves determining the middle value in a set of data that has been filtered according to specific criteria. This can be achieved by arranging the filtered data in ascending or descending order and finding the value that falls in the middle position. In cases where there is an even number of data points, the median is the average of the two middle values. The median can be easily calculated using the MEDIAN function in Excel, which takes the filtered range as its input. This allows for a quick and accurate determination of the median for a specific subset of data in an Excel spreadsheet.
Calculate Median of Filtered Rows in Excel
You can use the following syntax to calculate the median value of a filtered range in Excel:
=AGGREGATE(12,1,B2:B13)
The value 12 is a for calculating the median of a range and the value 1 tells Excel to ignore hidden rows.
The following example shows how to use this function in practice.
Example: Calculate Median of Filtered Rows in Excel
Suppose we have the following dataset that shows the number of sales made during various days by a company:

Next, let’s filter the data to only show the dates that are in January or April.
To do so, highlight the cell range A1:B13. Then click the Data tab along the top ribbon and click the Filter button.

Then click the dropdown arrow next to Date and make sure that only the boxes next to January and April are checked, then click OK:

The data will automatically be filtered to only show the rows where the dates are in January or April:

If we attempt to use the MEDIAN() function to find the average value in the Sales column, it will actually return the median of all of the original values:

Instead, we can use the AGGREGATE() function:

This function calculates the median of only the visible rows.
We can manually verify this by calculating the median of the visible rows:
Median of Sales in visible rows: [9, 13, 14, 14, 19]
When the values are arranged in ascending order, the value located in the middle is indeed 14.
The following tutorials explain how to perform other common operations in Excel:
Cite this article
stats writer (2024). How can I calculate the median of filtered rows in Excel?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-calculate-the-median-of-filtered-rows-in-excel/
stats writer. "How can I calculate the median of filtered rows in Excel?." PSYCHOLOGICAL SCALES, 26 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-calculate-the-median-of-filtered-rows-in-excel/.
stats writer. "How can I calculate the median of filtered rows in Excel?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-calculate-the-median-of-filtered-rows-in-excel/.
stats writer (2024) 'How can I calculate the median of filtered rows in Excel?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-calculate-the-median-of-filtered-rows-in-excel/.
[1] stats writer, "How can I calculate the median of filtered rows in Excel?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.
stats writer. How can I calculate the median of filtered rows in Excel?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.
