Sub topic 6
Finding extremes with MIN and MAX
Prerequisites: you should know how to enter formulas in Google Sheets and read cell references such as B2. This chapter assumes that you understand a range such as B2:B6, which means every cell from B2 through B6.
What MIN and MAX do
MIN returns the smallest numeric value in a group of cells. MAX returns the largest numeric value. Both functions are useful for finding the lower and upper ends of a data set.
Suppose column B contains these values:
| Cell | Value |
|---|---|
| B2 | 18 |
| B3 | 7 |
| B4 | 25 |
| B5 | 12 |
| B6 | 20 |
Use these formulas to find the extremes:
=MIN(B2:B6)
=MAX(B2:B6)MIN(B2:B6) returns 7. MAX(B2:B6) returns 25.
The range is passed as an argument to each function. An argument is a value or reference supplied between a function's parentheses.
How different cell contents are treated
When you give MIN or MAX a cell range, the functions use numeric values and ignore blank cells and text. A zero is a valid number, so it can become the minimum value.
Numbers stored as text are different. For example, a cell containing the text "7" may look numeric, but a range-based MIN or MAX call does not treat it as a number. Convert the value to a number before relying on it in an aggregate calculation.
| Cell content | Used by MIN and MAX in a range? | Effect |
|---|---|---|
| `12` | Yes | Participates in the comparison |
| `0` | Yes | Can be the minimum |
| Blank cell | No | Ignored |
| Text such as `low` | No | Ignored |
| Number stored as text | No | Ignored |
| Error value | No | The formula usually returns that error |
If a range contains no numeric values, the result can be 0. That result may be misleading because it can look like a real measured minimum or maximum. Check that the source range contains numbers before interpreting the result.
Multiple arguments and dates
You can pass several ranges or individual numeric values to one call. Separate arguments with commas.
=MIN(B2:B6, D2:D6, 100)
=MAX(B2:B6, D2:D6, 100)These formulas compare all numeric cells in both ranges along with the literal value 100. A literal value is a number written directly in the formula instead of stored in a cell.
Dates in Google Sheets are stored internally as numbers. Therefore, MIN can find the earliest date and MAX can find the latest date in a date range. Format the result as a date if Sheets displays the underlying serial number.
Common errors
A range containing an error such as #VALUE! can make the entire MIN or MAX formula return an error. Fix the source error first when possible. Do not hide errors automatically if they indicate invalid data that needs correction.
Use MIN and MAX when you need the actual endpoints of a numeric range. If you need the smallest or largest value only for matching rows, use a conditional function such as MINIFS or MAXIFS when it fits your Sheets version and data design.
Exercise
Cells B2:B6 contain 18, a blank, 0, the text "7", and 25. What do =MIN(B2:B6) and =MAX(B2:B6) return?
Show answer
MIN returns 0 because zero is numeric and smaller than 18 and 25. MAX returns 25. The blank and the text "7" are ignored.