MAX
Return the biggest numeric value, ignoring text and blanks.
Syntax
MAX(number1, [number2], ...) | Argument | Required | Description |
|---|---|---|
number1 | Required | A range or value. |
number2 | Optional | Further ranges or values. |
Examples
Every example below was executed against VisiGrid engine 0.35.0 — not
transcribed from another vendor's documentation. Reproduce any of them with vgrid calc.
| Formula | Result | Notes |
|---|---|---|
=MAX(A1:A5) | 30 | |
=MAX(A2:A2) | 0 | A range with no numbers in it returns zero, not an error. |
Zero is not the same as “nothing”
MAX over a range holding only text or blanks returns 0. That is Excel’s
behaviour too, and it is a trap whenever negative numbers are possible — the
largest of -5 and -3 is -3, but the largest of nothing is reported as
0, which is larger than both.
If the range might be empty and negatives are in play, check first:
=IF(COUNT(A1:A5)=0, "", MAX(A1:A5))
Clamping
MAX(A1, 0) is the idiomatic floor — never let a value go below zero — and
MIN is the ceiling. Combined, MIN(MAX(A1,0),100) clamps
to a range in one expression.
Excel compatibility
Matches Excel, including returning 0 when nothing numeric is present.