How to Delete Excel Rows Containing a Specific Value (-9999)
Question details
The user needs to efficiently remove all rows containing the missing-data marker "-9999" from a massive Excel dataset without checking them manually.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Cleaning up a large dataset by removing rows with specific missing-data placeholders (-9999).
- Observed behavior
- Manually checking over 100,000 rows is inefficient and impractical, requiring an automated or bulk deletion method to handle the heavy workload.
Before modifying large datasets, always create a backup copy of your workbook to prevent accidental data loss in case of an error during the bulk deletion process.
Use a Helper Column and Filter Method
This is the safest and most accessible method for users. It uses a formula to flag rows containing the target value and deletes them in bulk using filters.
By creating a helper column, you can use Excel's built-in formulas to evaluate every cell in a row simultaneously. This method avoids the need for complex programming while handling large volumes of data efficiently.
Add a new helper column at the end of your dataset. Enter the formula =ISNUMBER(MATCH(-9999,B2:HE2,0)) in the first row of the data. Adjust the range 'B2:HE2' to match the actual data columns you want to search.
Double-click the fill handle (the small square at the bottom-right corner of the cell) or drag it down to apply the formula to all 100,000+ rows.
Select the header row, go to the 'Data' tab on the ribbon, and click 'Filter'. Click the filter dropdown arrow on your new helper column and check only the box for 'TRUE'.
Select all the visible rows containing the data, right-click the row numbers on the left, and choose 'Delete Row'. Finally, clear the filter from the Data tab and delete the helper column.

Automate Deletion Using a VBA Macro
Best for recurring tasks or extremely large datasets where formula calculation might slow down the workbook.
Use Find and Replace to Select Rows
A quick built-in alternative to delete specific rows without using formulas or macros.
Clean Up Large Datasets Fast with WPS Spreadsheet
WPS Spreadsheet is fully equipped to handle large datasets seamlessly, offering robust formula support, advanced filtering, and VBA macro compatibility to clean up your data efficiently.
- 1. Open Your File: Launch WPS Spreadsheet and open your large dataset.
- 2. Add the Formula: Insert the helper formula =ISNUMBER(MATCH(-9999, A2:Z2, 0)) in a new column and drag it down.
- 3. Filter the Data: Use the Filter tool under the Data tab to display only the 'TRUE' values.
- 4. Delete and Save: Highlight the visible rows, right-click, select 'Delete', and save your cleaned document.

Frequently Asked Questions
Why does Excel freeze when I delete thousands of rows at once?
Excel might freeze or take a long time because it recalculates formulas and updates the screen graphics for every single row being deleted. Setting calculation to 'Manual' and turning off 'Screen Updating' before the deletion can significantly improve performance.
Does the MATCH formula work if the value -9999 is part of a text string?
No, the standard MATCH formula looks for exact cell value matches. If '-9999' is embedded within other text in a cell (e.g., 'Error code -9999'), you should use a wildcard search with the SEARCH function combined with ISNUMBER instead.
Can I use the Sort feature instead of filtering to delete the rows?
Yes. After creating the helper column that outputs TRUE or FALSE, you can select your entire dataset and Sort by the helper column. All the TRUE rows will group together, allowing you to highlight them all at once and delete them quickly.




