New Tool Radar

AI for Data & Spreadsheets

How to Clean Blank Rows and Columns from a CSV in Excel

Remove blank rows and columns from a CSV in Excel so the table is tight, sortable and ready for formulas.

Schematic illustration for How to Clean Blank Rows and Columns from a CSV in Excel: three numbered steps - Select the data range; Go To Special, Blanks; Delete blank rows.

A CSV with blank rows scattered through it breaks sorting, filtering and totals, because Excel treats each block as a separate table. Removing the blanks in one pass, rather than deleting them one by one, leaves a single tight table that formulas can cover.

Prerequisites

  • Excel
  • The CSV opened in Excel
  • A copy of the source file, so the original stays untouched.

Steps

  1. Select the data range and press Ctrl+End to see how far the used range extends beyond the real data.
  2. Select the range, press F5, Special, Blanks, to select all blank cells in the range.
  3. Right-click and choose Delete, Entire row, to remove the blank rows, then repeat for blank columns.
  4. Check the row count against the source and confirm the first row holds the headers.
  5. Save the cleaned file as .xlsx and keep the original CSV.

Worked example: Fictional class register after removing blanks

The practice table below is a fictional five-student register after cleaning. The count column is 1 per student, and the total is the number of students. The table below is fictional practice material, with fictional values. It is the expected result, worked out by hand, not a run of any tool.

Student Count
Farah 1
George 1
Hannah 1
Ivan 1
Julia 1
Total 5

Expected result. Five students, no blank rows, and the count is 5.

Limits

  • A blank row can be a deliberate separator between two tables in one sheet, so check the source before deleting.
  • Deleting entire rows can remove data in columns outside the selected range, so select the range first.

Sources

See all