by Alexander Frolov, updated on
This article lists several ways to delete rows in Excel based on a cell value. In this post you'll find hotkeys as well as Excel VBA. Delete rows automatically or use the standard Find option in combination with helpful shortcuts.
Excel is a perfect tool to store data that change every now and then. However, updating your table after some changes may need really much time. The task can be as simple as removing all blank rows in Excel. Or you may need to find and delete the duplicated data. One thing we know for sure is that whenever details come or go, you search for the best solution to help you save time on the current work.
For example, you have a marketplace where different vendors sell their products. For some reason one of the vendors closed their business and now you need to delete all rows that contain the vendor's name, even if they are in different columns.
In this post you'll find Excel VBA and shortcuts to delete rows based on certain text or value. You'll see how to easily find and select the necessary information before removing. If your task is not about deleting but adding rows, you can find how to do it in Fastest ways to insert multiple rows in Excel.
If you want to use the fastest method of deleting multiple rows according to the cell value they contain, you need to correctly select these rows first.
To select the rows, you can either highlight the adjacent cells with the needed values and click Shift + Space or pick the needed non-adjacent cells keeping the Ctrl key pressed.
You can also select entire lines using the row number buttons. You'll see the number of the highlighted rows next to the last button.
After you select the necessary rows, you can quickly remove them using an Excel "delete row" shortcut. Below you'll find how to get rid of the selected lines whether you have a standard data table, or a table that has data to the right.
If you have a simple Excel list that has no additional information to the right, you can use the delete row shortcut to remove rows in 2 easy steps:
You'll see the unused rows disappear in a snap.
Tip. You can highlight only the range that contains the values you want to remove. Then use the shortcut Ctrl + - (minus on the main keyboard) to get the standard Excel Delete dialog box allowing you to select the Entire row radio button, or any other deleting option you may need.
Ctrl + - (minus on the main keyboard) Excel shortcut is the fastest means to delete rows. However, if there is any data to the right of your main table like on the screenshot below, it may remove rows along with the details you need to keep.
If that's your case, you need to format your data as Excel Table first.
You will see the Create Table dialog box that you can use to highlight the necessary range.
Note. Please make sure you don't use the row buttons to select the entire rows.
Hope you've found this "remove row" shortcut helpful. Continue reading to find Excel VBA for deleting rows and learn how to eliminate data based on certain cell text.
If the items in the rows you want to remove appear only in one column, the following steps will guide you through the process of deleting the rows with such values.
Finally click on the Filter icon again to clear it and see that the rows with the values disappeared from your table.
The filter option allows sorting your data based on the color of cells. You can use it to delete all rows that contain certain background color.
That's it! The rows with identically colored cells are removed in an instant.
If the values you want to remove are scattered around different columns, sorting may complicate the task. Below you'll find a helpful tip to remove rows based on the cells that contain certain values or text. From my table below, I want to remove all rows that contain January which appears in 2 columns.
Tip. You can find the same dialog box if you go to the Home tab -> Find & Select and pick the Find option from the drop-down list.
Select the found values in the window keeping the Ctrl key pressed. You will get the found values automatically highlighted in your table.
Tip. You can delete the rows with the selected values if you press Ctrl + - (minus on the main board) and select the radio button Entire rows.
Voila! The unwanted rows are deleted.
If you always search for a solution to automate this or that Excel routine, grab the macros below to streamline your delete-rows task. In this part you'll find 2 VBA macros that will help you remove rows with the selected cells or delete every other row in Excel.
The macro RemoveRowsWithSelectedCells will eliminate all lines that contain at least one highlighted cell.
The macro RemoveEveryOtherRow as its name suggests, will help you get rid of every second/third, etc., row according to your settings. It will remove rows beginning with the current mouse cursor location and till the end of your table.
If you don't know how to insert macros, feel free to look at How to insert and run VBA code in Excel.
Tip. If your task is to color every second/third, etc., row with a different color, you will find the steps in Alternating row color and column shading in Excel (banded rows and columns).
In this article I described how to delete rows in Excel. Now you have several useful VBA macros to delete the selected rows, you know how to remove every other row and how to use Find & Replace to help you search and select all the lines with the same values before eliminating them. Hope the tips above will simplify your work in Excel and let you get more free time for enjoying these last summer days. Be happy and excel in Excel!
Table of contents