How to find the maximum value that meets a condition (MAX IF)
✓ Verified in LibreOffice 25.8.7.3Get the largest number in a range, but only for rows that match a criterion.
The formula
| App | Formula | Notes |
|---|---|---|
| Excel | =MAXIFS(B2:B5,A2:A5,"North") | MAXIFS(max_range, criteria_range, criteria). Excel 2019+. |
| Google Sheets | =MAXIFS(B2:B5,A2:A5,"North") | Identical. |
| LibreOffice Calc | =MAXIFS(B2:B5,A2:A5,"North") | Identical (LibreOffice 5.2+). |
How it works
MAXIFS returns the maximum of B2:B5 restricted to the rows where A2:A5 equals 'North'. Those values are 10, 30 and 20, so the result is 30 - the South row's 50 is ignored. Use MINIFS the same way for a conditional minimum.
Verified, not just documented
We ran =MAXIFS(B2:B5,A2:A5,"North") in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 30 — exactly the expected result. Every formula here is confirmed by actually executing it.