Return the smallest and largest numbers in a range.
MIN returns the smallest number in what you give it and MAX returns the largest. Both skip text, blanks and logical values entirely, which is what makes them safe to point at a column that also contains a header or a stray label.
Their less obvious use is capping. =MIN(A2, 100) returns whichever is smaller, so it clamps a value to a ceiling of 100; =MAX(A2, 0) clamps it to a floor of zero, which is the standard way of stopping a calculated figure going negative. Nesting them — =MIN(MAX(A2, 0), 100) — holds a value inside a band.
For extremes under a condition, MINIFS and MAXIFS follow the SUMIFS pattern exactly: the range to examine first, then pairs of criteria range and criteria.
=MIN(number1, [number2], …) =MAX(number1, [number2], …)number1number2, …Headers in row 1, data in A2:D6. C4 is blank and C6 holds text.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Sensor | Reading | Calibration | Batch |
| 2 | North inlet | 17 | 3 | 12 |
| 3 | South inlet | -4 | 5 | 7 |
| 4 | Header tank | 63 | 12 | |
| 5 | Overflow | 8 | 2 | 9 |
| 6 | Return line | -21 | n/a | 7 |
=MIN(B2:B6)Result: -21
The smallest reading, negative included.
=MAX(B2:B6)Result: 63
The largest. Both ignore the blank and the text in column C if pointed there.
=MAX(B2, 0)Result: 17
Clamping to a floor of zero. On row 3, where the reading is -4, this would return 0.
=MINIFS(B2:B6, D2:D6, 12)Result: 17
The smallest reading in batch 12. MINIFS puts the range to minimise first, like SUMIFS.
Reading about a formula is not the same as writing one. Open this function's exercise and type it into a real grid — you get instant feedback on exactly which cell is wrong and why.
Why it happens: Every number in the range is stored as text, so both functions skip all of them and fall back to 0.
How to fix it: Text numbers align left by default. Convert the column with VALUE or Text to Columns.
Why it happens: MIN and MAX skip TRUE/FALSE and text, even when the text looks numeric.
How to fix it: MINA and MAXA include logicals and treat text as 0, if that is genuinely what you want.
Why it happens: A referenced cell holds an error, which propagates.
How to fix it: Wrap the source in IFERROR, or find and fix the upstream error — usually better.
Use MAXIFS: =MAXIFS(B2:B100, D2:D100, 12) returns the largest reading in batch 12. The range you are taking the maximum of comes first, then criteria range and criteria pairs, exactly like SUMIFS.
Yes. Blanks, text and logical values are all skipped. This means MIN over a column with one number and ninety-nine blanks returns that number rather than 0.
Wrap it in MAX with zero: =MAX(your_formula, 0). Whichever is larger wins, so anything below zero becomes zero. The mirror trick with MIN caps an upper bound.
Longer reads where this function does real work in a real sheet.