How to Hide Blank Cells in Excel (5 Easy Methods)

We will use a dataset containing information about some sellers’ sales amounts. The dataset has some blank cells. As we can’t hide the blank cells individually, we will try to hide the row or column that contains them.


Method 1 – Using the ‘Go To Special’ Feature

STEPS:

  • Select any cell in your dataset and press Ctrl + A to select all used cells.

Hide Rows or Columns Containing Blank Cells with Go To Special Feature

  • Go to the Home tab and click on Find & Select. A drop-down menu will appear.
  • Select Go To Special from there. It will open the Go To Special window.

Hide Rows or Columns Containing Blank Cells with Go To Special Feature

  • Select Blanks and click OK to proceed.

Hide Rows or Columns Containing Blank Cells with Go To Special Feature

  • Press Ctrl + 9 to hide Rows 6, 8, and 10.

Hide Rows or Columns Containing Blank Cells with Go To Special Feature

  • To hide columns that contain blank cells, press Ctrl + 0.

Hide Rows or Columns Containing Blank Cells with Go To Special Feature

Read More: How to Hide Extra Cells in Excel


Method 2 – Using the Excel Hide Option 

STEPS:

  • Select Column F.
  • Press Ctrl + Shift + Right Arrow to select all the columns from Column F.

Use Excel Hide Option to Remove Unused Cells

  • Go to the Home tab and click on the Format option. A drop-down menu will appear.
  • Select Hide & Unhide and select Hide Columns.

Use Excel Hide Option to Remove Unused Cells

  • After hiding columns, the dataset will look like the picture below.

Use Excel Hide Option to Remove Unused Cells

  • Select Row 11.

Use Excel Hide Option to Remove Unused Cells

  • Press Ctrl + Shift + Down Arrow to select all the rows from Row 11.

Use Excel Hide Option to Remove Unused Cells

  • Go to the Home tab and select Format. A drop-down menu will appear.
  • Select Hide & Unhide and select Hide Rows.

Use Excel Hide Option to Remove Unused Cells

  • You can remove the unused cells except for the range A1:E10.

Use Excel Hide Option to Remove Unused Cells

Read More: How to Hide Confidential Data in Excel


Method 3 – Inserting a Filter to Hide Blank Cells 

STEPS:

  • Select cell E5 and enter the formula below:
=COUNTA(B5:D5)

Insert Filter to Hide Blank Cells of Rows in Excel

This formula counts the number of non-empty cells in the range B5:E5.

  • Press Enter and drag the Fill Handle down.

Insert Filter to Hide Blank Cells of Rows in Excel

  • After dragging the Fill Handle down, the dataset will look like the picture below. You can see Rows 6 and 8 contain 0 non-empty cells.

Insert Filter to Hide Blank Cells of Rows in Excel

  • Go to the Home tab and select Sort & Filter. A drop-down menu will appear.
  • Select Filter.

Insert Filter to Hide Blank Cells of Rows in Excel

  • You will see filters in the headers of the dataset.

Insert Filter to Hide Blank Cells of Rows in Excel

  • Click on the drop-down arrow of Blank Cells to open the menu and uncheck 0.
  • Click OK to proceed.

Insert Filter to Hide Blank Cells of Rows in Excel

  • You will see Rows 6 and 8 are hidden.

Insert Filter to Hide Blank Cells of Rows in Excel


Method 4 – Using the Context Menu

STEPS:

  • Select Row 6.
  • Right-click on the row number to open the Context Menu.
  • Select Hide.

Hide Blank Cells of Entire Row or Column Using Context Menu

  • Row 6 will be hidden.

  • You can repeat the above steps to hide Rows 8 and 10.

  • Right-click on the column number to open the Context Menu.
  • Select Hide from there.

  • You can also hide Column C.


Method 5 – Applying Excel VBA 

STEPS:

  • Right-click on the name of the sheet to open the Context Menu.
  • Select View Code. It will open the Code window.

  • In the Code window, enter the VBA code below:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim val As Range
    Application.ScreenUpdating = False
        For Each val In ActiveSheet.UsedRange
            If val.Value = "" Then
                val.EntireRow.Hidden = True
            End If
        Next val
    Application.ScreenUpdating = True
End Sub

If we insert a blank cell, the entire row containing the blank cell will be hidden. For example, if we make cell C7 blank, the VBA code will hide the entire Row 7.

  • Press Ctrl + S to save the code.
  • Remove cell contents from cell C7.

  • Press Enter to see results like the picture below.

Note: If you run the VBA code, you can’t undo the changes. That is why you should also know how to unhide cells in Excel.


Download the Practice Book

You can download the practice book from here.


Related Article


<< Go Back to Hide Cells | Excel Cells | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Mursalin Ibne Salehin
Mursalin Ibne Salehin

Mursalin Ibne Salehin holds a BSc in Electrical and Electronics Engineering from Bangladesh University of Engineering and Technology. Over the past 2 years, he has actively contributed to the ExcelDemy project, where he authored over 150 articles. He has also led a team with content development works. Currently, he is working as a Reviewer in the ExcelDemy Project. He likes using and learning about Microsoft Office, especially Excel. He is interested in data analysis with Excel, machine learning,... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo