# MEDIAN formula generator

> Describe what you need and get a MEDIAN formula for Excel and Google Sheets, run on real data before you copy it. Plus 4 tested MEDIAN examples.

Source: https://spreadsheetpractice.com/tools/formula-generator/median · Updated October 29, 2026 · Formulas and results on this page were run by the Spreadsheet Practice formula engine on November 20, 2026

MEDIAN returns the middle value once the numbers are sorted.

Describe the task at [MEDIAN formula generator](https://spreadsheetpractice.com/tools/formula-generator/median) and get a MEDIAN formula for Excel and Google Sheets, tested on real data.

## Tested MEDIAN examples

### Find the median

`=MEDIAN(B2:B11)`

Excel. Result on the sample sheet: $301,500. [See it and try it](https://spreadsheetpractice.com/formulas/find-the-median)

### Calculate the percentage of time elapsed between two dates

`=MIN(1,MAX(0,($G$1-B2)/(C2-B2)))`

Excel. Result on the sample sheet: 5 rows (D2:D6). [See it and try it](https://spreadsheetpractice.com/formulas/percentage-of-time-elapsed-between-two-dates)

### Calculate a median with criteria in Excel (MEDIAN IF)

`=MEDIAN(FILTER(C2:C10,B2:B10=F1))`

Excel. Result on the sample sheet: $118,000. [See it and try it](https://spreadsheetpractice.com/formulas/median-if)

### Calculate working hours between two dates and times

`=((NETWORKDAYS(B2,C2)-1)*($G$2-$G$1)+IF(NETWORKDAYS(C2,C2),MEDIAN(MOD(C2,1),$G$1,$G$2),$G$2)-MEDIAN(NETWORKDAYS(B2,B2)*MOD(B2,1),$G$1,$G$2))*24`

Excel. Result on the sample sheet: 6 rows (D2:D7). [See it and try it](https://spreadsheetpractice.com/formulas/working-hours-between-two-dates-and-times)

## Questions

### What does the MEDIAN formula generator do?

You describe the task in plain English, and it writes the formula, using MEDIAN where that's the right tool, for your table or a sample one. The formula is run in our engine in Excel and Google Sheets mode before you see it, so you get its result, not just a guess.

### What does MEDIAN do?

MEDIAN returns the middle value once the numbers are sorted.

### Can I learn to write MEDIAN formulas myself?

Yes. Each example below opens a page where you try the formula in a live grid and it's checked as you go, and the MEDIAN function page has a practice exercise.

---

Spreadsheet Practice (https://spreadsheetpractice.com) teaches spreadsheet formulas by practice: every exercise is graded in a live grid and re-checked on changed data.
