How to remove blank cells from a list
✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)Get a clean, gap-free version of a column that has empty cells scattered through it.
The formula
| App | Formula | Notes |
|---|---|---|
| Excel (desktop) | =FILTER(A2:A6,A2:A6<>"") | Excel 365/2021. The result spills into as many cells as there are non-blanks. |
| Google Sheets | =FILTER(A2:A6,A2:A6<>"") | Identical. |
| LibreOffice Calc | =FILTER(A2:A6,A2:A6<>"") | Needs LibreOffice 24.8+. |
How it works
FILTER keeps only the cells where the condition is true; A2:A6<>"" is true for non-blank cells, so the gaps at A3 and A5 disappear and the three fruit names spill as a compact list. The output is live — clearing or filling source cells updates it instantly. If every cell is blank, FILTER returns #CALC! (Excel) or #N/A; wrap in IFERROR for a friendly message.
Verified, not just documented
We ran =FILTER(A2:A6,A2:A6<>"") in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned apple, banana, cherry — 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 apple, banana, cherry 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
FILTER — see full Excel, Google Sheets & LibreOffice compatibility for each.
Related recipes
- How to average a range that contains errors
- How to count unique values that match a condition
- How to FILTER by multiple criteria (AND / OR)
- How to find values that appear in both of two lists
- How to use the FILTER function