Supposing, you have a range of data in a google sheet, now, you would like to delete the rows based on cell values in a column. For example, I want to delete all rows which contain the text “Complete” in Colum C. This article, I will talk about how to solve it in Google sheets. Delete all rows containing specific text within a column with script code
Delete all rows containing specific text within a column with script codeTo remove all rows which include the specific text in a column, the following script code can do you a favor, please do as this: 1. Click
Tools > Script editor, see screenshot: 2. In the new opened code window, copy and paste the following code into the blank code window, see screenshot: function deleteRows() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = ss.getSheetByName('delete containing');
var r = s.getRange('C:C');
var v = r.getValues();
for(var i=v.length-1;i>=0;i--)
if(v[0,i]=='Complete')
s.deleteRow(i+1);
};
Note: In the above code, “delete containing” is the sheet name containing the data you want to delete, “C:C” is the column with specific text you want to delete from, “Complete” is the specific text that you want to delete rows based
on, please change them to your need. 3. Then save this code, and then click Run button in the code window to execute this script code, see screenshot: 4. And all rows which containing the specific text “Complete” have been deleted at once, see screenshot:
Delete all rows containing specific text in Excel worksheet: If you want to remove all rows which contain a specific value in a column, the Kutools for Excel's Select Specific Cells feature can help you to select all rows matched the criteria, and then
you just need to delete the rows at once. Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in 30 days. Download and free trial
Now!
The Best Office Productivity ToolsKutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%- Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
- Super
Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
- Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
- Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find
and Fuzzy Find in Many Workbooks; Random Select...
- Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
- Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
- Super Filter (save and apply filter schemes
to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
- Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
- More than 300 powerful features. Supports Office / Excel 2007-2021 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features
30-day free trial. 60-day money back guarantee.
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier- Enable tabbed editing and reading in
Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Comments (15) No ratings yet. Be the first to rate! |