← All how-to recipes

How to count non-blank (non-empty) cells

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

Count how many cells in a range actually contain something, ignoring the empty ones.

The formula

AppFormulaNotes
Excel=COUNTA(A2:A6)COUNTA counts anything non-empty. COUNT counts only numbers; COUNTBLANK counts the empties.
Google Sheets=COUNTA(A2:A6)Identical.
LibreOffice Calc=COUNTA(A2:A6)Identical.

How it works

COUNTA counts every cell that is not empty, whether it holds text or numbers. With values only in A2, A4 and A6 (A3 and A5 blank), it returns 3. Use COUNT for numbers only, or COUNTBLANK for the empty ones.

Verified, not just documented

We ran =COUNTA(A2:A6) in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 3 — 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 3 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 Excel.

Functions used

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

Related recipes

Related comparisons