Should you need to find the middle value in a set of data in your spreadsheet without having to do it manually, Google Sheets has a function that does it instantly for you. Here’s how to use the MEDIAN function.

Fire up Google Sheets and open a spreadsheet with datasets for which you want to find the median.

Click on an empty cell and type =MEDIAN(, [, …]) into the cell or the formula entry field, replacing and with the values or ranges to consider for calculating.

The MEDIAN function in Google Sheets supports any number of arguments, and anything other than the first value is optional. It will look something like this:

After you press the “Enter” key, the cell will now contain the median of the numbers you put in the function.

If you want to use a range of cells as values, it will look like this:

After you press the “Enter” key, the cell will contain the median value of the range you provided to the function.

Some things to note about the MEDIAN function: Anything entered is sorted numerically, from the lowest to highest value, and cells that are empty—excluding “0”—and that contain text will be ignored by the function.

The MEDIAN function returns the midmost value in a numerical dataset if the set contains an odd number of values. If you enter an even number of values, the MEDIAN function will estimate a response between the two center values.

For example, notice how we enter 36 values, none of which are “$31,” yet the function returns a median value of “$31.” This is because to find the median, the function adds the middle two numbers together and then divides by 2 to estimate the median. So, behind the scenes, it calculates (30 + 32) / 2 = 31 to produce the result.