How to delete rows with specific text in excel
Tutor 5 (273 Reviews)
Excel Tutor
Still stuck with a Excel question
Ask this expertAnswer
To delete rows with specific text in Excel, follow these steps carefully. You can do this using Filter, Find & Select, or VBA depending on your preference and data size.
Method 1: Using a Filter
-
Select the entire dataset, including headers.
-
Go to the Data tab on the ribbon.
-
Click Filter.
-
Click the drop-down arrow in the column where the text appears.
-
Uncheck Select All and check the specific text you want to delete.
-
Select all visible rows by clicking the row numbers on the left.
-
Right-click the selected rows and choose Delete Row.
-
Remove the filter to see the remaining data.
Note: This method works for both Windows and Mac, but the ribbon layout may differ slightly on Mac.
Method 2: Using Find & Select
-
Press Ctrl + F (Windows) or Command + F (Mac) to open the Find dialog.
-
Enter the specific text you want to locate.
-
Click Find All.
-
Press Ctrl + A (Windows) or Command + A (Mac) to select all found instances.
-
Close the Find dialog.
-
Right-click on any selected row number and choose Delete Row.
Method 3: Using VBA for Large Datasets
-
Press Alt + F11 (Windows) or Option + F11 (Mac) to open the VBA editor.
-
Go to Insert → Module.
-
Paste the following code:
Sub DeleteRowsWithSpecificText()
Dim ws As Worksheet
Dim rng As Range
Dim cell As Range
Dim textToDelete As String
textToDelete = "YourTextHere" 'Replace with the text you want to delete
Set ws = ActiveSheet
For Each cell In ws.UsedRange.Columns(1).Cells 'Change 1 to the column number
If cell.Value = textToDelete Then
If rng Is Nothing Then
Set rng = cell
Else
Set rng = Union(rng, cell)
End If
End If
Next cell
If Not rng Is Nothing Then rng.EntireRow.Delete
End Sub
Replace
"YourTextHere"with the text you want to remove.-
Close the VBA editor and run the macro from Developer → Macros → Run.
Note: Always back up your file before running VBA macros.
Important Tips
-
Deleting rows is permanent. Save a copy before making bulk deletions.
-
Use Filter for visual verification before deleting.
-
VBA is faster for thousands of rows.
-
Double-check column references in VBA to avoid deleting unintended data.
This approach ensures accuracy, whether your spreadsheet has hundreds or thousands of rows.
. Was this Helpful?Get Online Tutoring or Questions answered by Experts.
You can post a question for a tutor or set up a tutoring session
Answers · 1
How to sort by highlighted cells in excel
Answers · 1
How to sort excel by column and keep rows together
Answers · 1
How to sort by time in excel
Answers · 1
How to sort alphabetically in excel by last name
Answers · 1