Deleting every other row in Excel is a common data cleaning task that arises when you import raw data, merge datasets, or need to thin out a massive spreadsheet for analysis. Plus, whether you are dealing with a few hundred rows or tens of thousands, doing this manually is impractical and prone to error. Fortunately, Excel offers several strong methods to automate this process, ranging from built-in filtering tools to powerful VBA macros and modern Office Scripts. This guide walks you through the most effective techniques, helping you choose the right approach for your specific workflow and dataset size.
Using the Filter and Helper Column Method (Best for Most Users)
The most accessible and reliable method for deleting alternate rows involves creating a temporary helper column combined with Excel’s Filter feature. This approach requires no coding knowledge and works perfectly on standard datasets Simple as that..
- Insert a Helper Column: Click the column header immediately to the right of your data (e.g., Column Z if your data ends at Y). Type a header like
RowIDorFilterHelper. - Generate a Pattern: In the first data cell of this new column (e.g., Z2), enter the formula
=MOD(ROW(),2). This formula returns0for even-numbered rows and1for odd-numbered rows.- Alternative: If your data has a header row and you want to delete the 2nd, 4th, 6th data rows (keeping the 1st, 3rd, 5th), use
=MOD(ROW()-1,2)or simply type1in the first cell,0in the second, select both, and drag the fill handle down.
- Alternative: If your data has a header row and you want to delete the 2nd, 4th, 6th data rows (keeping the 1st, 3rd, 5th), use
- Apply the Formula: Double-click the fill handle (the small square at the bottom-right of the active cell) to copy the formula down to the last row of your dataset.
- Filter the Values: Select your header row (including the new helper column). Go to the Data tab and click Filter (or press
Ctrl + Shift + L). Click the filter dropdown arrow on your helper column header. - Select Rows to Delete: Uncheck Select All. Check only the value representing the rows you want to remove (e.g., check
0to delete even rows, or1to delete odd rows). Click OK. Your spreadsheet now displays only the rows marked for deletion; the hidden rows are the ones you intend to keep. - Delete Visible Rows: Select all the visible filtered rows (click the first row number, hold
Shift, click the last row number). Right-click the selection and choose Delete Row. - Clear the Filter: Click the Filter button on the Data tab again (or press
Ctrl + Shift + L) to remove the filter arrows. Your remaining data is now compressed, with every other row successfully removed. - Clean Up: Delete the helper column you created in step 1.
Pro Tip: If your dataset contains blank rows interspersed, the
MOD(ROW(),2)formula counts physical spreadsheet rows, not just data rows. For non-contiguous data, the manual1, 0drag-fill method is safer because it follows the visual sequence of your data rather than the absolute row number.
This is where a lot of people lose the thread.
The "Go To Special" Technique (Fastest for Static Patterns)
If you prefer not to use formulas or helper columns, you can use the Go To Special dialog to select rows based on their position. This is faster for one-off tasks on smaller sheets but requires a specific selection logic Not complicated — just consistent. No workaround needed..
- Select the first cell of the second row you wish to delete (e.g., if keeping row 2 and deleting row 3, select cell A3).
- Press
Ctrl + Shift + Down Arrowto select all cells down to the bottom of your data region. - Press
Ctrl + G(orF5) to open the Go To dialog, then click Special... - Select Rows (this doesn't exist as a direct option, so we use a workaround).
- Correction: The standard "Go To Special" does not have a "Select Every Other Row" button. The most efficient non-VBA workaround using this menu is actually selecting Constants or Formulas if your pattern aligns with data types, but for pure structural deletion, the Helper Column method above is superior.
- Actual Workaround: Select the entire dataset. Press
Alt + ;(Alt + Semicolon) to select Visible Cells Only after you have hidden rows manually? No, that's circular. - Verdict: Go To Special is not the right tool for "Every Nth Row" selection without a helper column. Stick to the Filter method for non-VBA solutions.
Using VBA Macros (Best for Repetitive Tasks & Large Datasets)
If you perform this operation daily or work with datasets exceeding 50,000 rows, a VBA Macro is exponentially faster. It bypasses the UI overhead of filtering and deleting row-by-row.
The Standard Deletion Macro
- Press
Alt + F11to open the Visual Basic for Applications (VBA) Editor. - In the Project Explorer (left pane), right-click your workbook name (e.g.,
VBAProject (Book1)), go to Insert > Module. - Paste the following code into the module window:
Sub DeleteEveryOtherRow()
Dim ws As Worksheet
Dim lastRow As Long
Dim i As Long
' Optimize performance
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Set ws = ActiveSheet
' Find the last used row in column A (change "A" if your key column differs)
lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
' Loop backwards to avoid shifting issues
' Step -2 deletes every other row starting from the bottom
' Change "lastRow" to "lastRow - 1" in the loop start if you want to keep row 1 and delete row 2
For i = lastRow To 2 Step -2
ws.Rows(i).Delete
Next i
' Restore settings
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
MsgBox "Alternate rows deleted successfully!", vbInformation
End Sub
- Close the VBA Editor and return to Excel.
- Press
Alt + F8, selectDeleteEveryOtherRow, and click Run.
Understanding the Loop Logic
The loop For i = lastRow To 2 Step -2 is the engine here.
- Backwards Loop (
Step -2): Deleting rows from the bottom up prevents the "shifting index" problem. If you delete row 2 while looping top-down, the old row 3 becomes the new row 2, causing the macro to skip it. Looping backwards ensures the row numbers of unprocessed rows remain stable. - Start Point:
lastRowdeletes the last row (if even count) or second-to-last. If you have a header in Row 1 and want to delete Row 2, 4, 6..., change the loop start tolastRow - 1(assuming lastRow is odd) or simply adjust theSteplogic. A safer dynamic approach:' Delete rows 2, 4, 6... (Keep 1, 3, 5...) For i = lastRow To 2 Step -1 If i Mod