← All how-to recipes

How to COUNTIF across multiple columns

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

Count matches in a whole grid, not just one column.

The formula

AppFormulaNotes
Excel (desktop)=COUNTIF(A2:C10,"yes")COUNTIF happily takes a 2-D range — this is all it needs.
Google Sheets=COUNTIF(A2:C10,"yes")Identical.
LibreOffice Calc=COUNTIF(A2:C10,"yes")Identical.

How it works

COUNTIF's range can be any rectangle — it scans every cell in the 3×3 grid and finds four "yes" values. The limitation people then hit: COUNTIFS requires all its criteria ranges to be the SAME shape, so you can't mix a 2-D range with a 1-D condition. For "count rows where ANY column says yes", use =SUMPRODUCT(--(COUNTIF(OFFSET(...)...))) patterns or simply add per-column COUNTIFS. Wildcards and comparisons work exactly as in the single-column case.

Verified, not just documented

We ran =COUNTIF(A2:C4,"yes") in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 4 — 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 4 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

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

Related recipes

Related comparisons