← All how-to recipes

How to find the minimum value with a condition

✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)

Get the smallest value among only the rows that match a criterion — like the lowest East-region sale.

The formula

AppFormulaNotes
Excel (desktop)=MINIFS(B2:B6,A2:A6,"East")Excel 2019+. Add more range/criteria pairs to AND conditions.
Google Sheets=MINIFS(B2:B6,A2:A6,"East")Identical.
LibreOffice Calc=MINIFS(B2:B6,A2:A6,"East")Identical.

How it works

MINIFS scans the criteria range and takes the minimum of the value range only where it matches — among East's 150, 80 and 200 the smallest is 80. MAXIFS is the mirror for the largest. If no row matches, MINIFS returns 0 rather than an error, which is worth guarding with a COUNTIF check when 0 could be mistaken for real data.

Verified, not just documented

We ran =MINIFS(B2:B6,A2:A6,"East") in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 80 — exactly the expected result. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned 80 for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.

Functions used

MINIFS — see full Excel, Google Sheets & LibreOffice compatibility for each.

Related recipes