Here is How You Can Calculate the Median in Excel Using the SUBTOTAL Function

  • Post author:
  • Post category:Uncategorized

It is actually easy to calculate the median of a range of values using the MEDIAN function. But then it is not such easy when dealing with a range of values and you want to find the median that meets multiple conditions. To know how to go about this, here is a guide that can help understand how to calculate the median using the SUBTOTAL function.

Figure 1: How to find median using SUBTOTAL function

General syntax of the formula

{=MEDIAN(IF(SUBTOTAL(3,OFFSET(A1:A10,ROW(A1:A10)-MIN(ROW(A1:A10)),,1)),A1:A10))}

Where;

  • A1:A10- refers to the range of values for which we want to find the median for.

How the formula works

  • For the above formula to work, we need to first arrange the data we have either an ascending or descending order. This is done by the MIN function in the formula.
  • The IF function will then help sort our data based on the supplied criteria.
  • The subtotal function will be responsible for finding the subtotals based on the criteria that we have used.
  • We then use the MEDIAN function to get the median of the values, based on subtotals in a given range of values.
  • It is important to note that this is an array formula, and thus should be entered in an array form. i.e. Control + Shift + Enter.