Skip to main content

How to hide rows based on cell value in Excel?

Author: Sun Last Modified: 2024-11-25

When working with large datasets in Excel, you may often need to hide rows based on specific cell values to streamline your data view or focus on relevant information. This process can be tedious if done manually. Fortunately, in this tutorial, we'll explore three effective methods for hiding rows based on cell values in another column.

hide rows based on cell value

Hide rows based on cell value with Filter

The Filter function in Excel is a straightforward way to hide rows based on specific cell values. This built-in feature allows you to filter out data that meets certain criteria, effectively hiding rows that do not match your specified conditions. This method is ideal for quick, manual adjustments and can be easily reversed if needed.

1. Select the data you want to filter out, and click Data > Filter. See screenshot:

click Data > Filter

2. Then click on the down arrow to display the filter drop down list, and click Number Filters (or Text Filters) > Greater Than (you can choose other criterion you need from the submenu). See screenshot:

specify the criteria from the Filter feature

3. In the popping dialog, type the criterion into the textbox next to is greater than. See screenshot:

type the criterion into the textbox

4. Click OK. Now the only the data greater than 3000 is shown, and the rows whose data is smaller than 3000 are hidden.

specific rows are filtered


Quickly select rows based on cell value with Kutools for Excel

Kutools for Excel offers a powerful feature – Select Specific Cells to streamline the process of selecting rows based on cell values. While it doesn’t directly hide rows, it allows you to quickly select all rows that meet specific criteria, which you can then manually hide or perform further actions on. This method is highly efficient for handling large datasets and performing batch operations.

Kutools for Excel offers over 300 advanced features to streamline complex tasks, boosting creativity and efficiency. Itegarate with AI capabilities, Kutools automates tasks with precision, making data management effortless. Detailed information of Kutools for Excel...         Free trial...

After downloading and installing Kutools for Excel, click Kutools > Select > Select Specific Cells to open the Select Specific Cells dialog box. Then configure the dialog as follows.

  1. Select the column range containing numbers as the basis for row selection.
  2. Select the Entire row option in the Selection type section.
  3. In the first Specific type drop-down list, select Less than, and then enter 3000 into the text box to fiter rows where the value is less than 3000.
  4. Click the OK button.
    specify the options in the dialog box
Result

All rows where the numbers in column B are less than 3000 will be automatically selected.

All rows meet the criteria are selected
Notes:

Hide rows based on cell value with VBA code

Moreover, if you are interested in VBA code, here I can introduce a VBA code to hide rows based on cell value.

1. Press Alt + F11 keys to enable Microsoft Visual Basic for Applications window.

2. Then click Insert > Module to open a new Module window, and paste below VBA code into it.

VBA: Hide rows based on cell value.

Sub HideRow()
'Updateby20150618
Dim Rng As Range
Dim WorkRng As Range
Dim xNumber As Integer
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
xNumber = Application.InputBox("Number", xTitleId, "", Type:=1)
For Each Rng In WorkRng
    Rng.EntireRow.Hidden = Rng.Value < xNumber
Next
End Sub

3. Then press F5 key to run the VBA, then select the data range you want to hide rows into the popping dialog (excluding headers). See screenshot:

vba code to select the data range

4. Click OK, and type the criterion number into the second dialog. See screenshot:

vba code to type the criterion in the prompt box

5. Click OK. Now the rows whose data is smaller than 3000 are hidden.

Tip: If you want to hide rows which are greater than 3000, just change Rng.EntireRow.Hidden = Rng.Value < xNumber to Rng.EntireRow.Hidden = Rng.Value > xNumber, or if you want to hide rows whose data is equal to 3000, change to Rng.EntireRow.Hidden = Rng.Value = xNumber.


Hide Rows Based on Cell Value

 

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more
Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...


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!