How To Delete Every Other Row In Excel

6 min read

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..

  1. 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 RowID or FilterHelper.
  2. Generate a Pattern: In the first data cell of this new column (e.g., Z2), enter the formula =MOD(ROW(),2). This formula returns 0 for even-numbered rows and 1 for 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 type 1 in the first cell, 0 in the second, select both, and drag the fill handle down.
  3. 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.
  4. 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.
  5. Select Rows to Delete: Uncheck Select All. Check only the value representing the rows you want to remove (e.g., check 0 to delete even rows, or 1 to 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.
  6. 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.
  7. 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.
  8. 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 manual 1, 0 drag-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..

  1. 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).
  2. Press Ctrl + Shift + Down Arrow to select all cells down to the bottom of your data region.
  3. Press Ctrl + G (or F5) to open the Go To dialog, then click Special...
  4. 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

  1. Press Alt + F11 to open the Visual Basic for Applications (VBA) Editor.
  2. In the Project Explorer (left pane), right-click your workbook name (e.g., VBAProject (Book1)), go to Insert > Module.
  3. 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
  1. Close the VBA Editor and return to Excel.
  2. Press Alt + F8, select DeleteEveryOtherRow, 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: lastRow deletes 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 to lastRow - 1 (assuming lastRow is odd) or simply adjust the Step logic. A safer dynamic approach:
    ' Delete rows 2, 4, 6... (Keep 1, 3, 5...)
    For i = lastRow To 2 Step -1
        If i Mod 
Just Hit the Blog

Out This Week

More of What You Like

Round It Out With These

Thank you for reading about How To Delete Every Other Row In Excel. We hope the information has been useful. Feel free to contact us if you have any questions. See you next time — don't forget to bookmark!
⌂ Back to Home