8 Ways to Show Zero as Blank in Excel

Do you want to hide the zero values in your data? This post is going to show you all the ways you can display zero values as blanks in Microsoft Excel.

A common technique used in Excel is to format zero values as blanks. This can help improve the readability and comprehensibility of the spreadsheet.

It’s difficult to quickly identify which cells contain zero values when you have a lot of data. When you signify zero values as blanks, it gives you a visual indication and makes it simpler to spot patterns in the data.

A zero value in your data might also mean that no data exists. If this is the case, then displaying a blank would be a better option.

Read on to see all the methods for displaying zeros as blanks in Excel. Get your copy of the example workbook used in this post to follow along.

Show Zero as Blank with Custom Format

The best method for showing your zero values as a blank is to use a custom number format. This will allow you to choose exactly how to display your positive, negative, and zero values.

Follow these steps to apply a custom format that shows zeros as blanks.

  1. Select the range of values to which you want to apply a custom format.
  1. Go to the Home tab in the ribbon.
  2. Click on the Launch icon in the lower right or the Number section.

This will open the Format Cells dialog box which will allow you to adjust a variety of cell formatting options including any number format.

💡 Tip: You can also open the Format Cells menu by using the Ctrl + 1 keyboard shortcut.

  1. Go to the Number tab in the Format Cells menu.
  2. Select the Custom option in the Category section.
  3. Enter the $#,##0;-$#,##0; format string into the Type field.
  4. Press the OK button.

The format string used in the custom number format consists of three parts separated by a ; character.

The first part determines the format to use for positive numbers, the second part determines the format to use for negative numbers, and the third part determines the format used on zero values.

Notice in this format string the last part after the second ; character is empty? This results in the zero values showing as blanks!

This will result in the zeros of your select range appearing blank in the cells.

If you select any of these blank cells, you will notice the formula bar still shows the zero value. The cells will still contain their zero value, but the formatting causes them to display as blanks in the grid.

Show Zero as Blank with Excel Options

There is an Excel setting that will allow you to hide zeros for your entire sheet.

This way you don’t need to select a specific range to apply format, all the zero values in your sheet will be hidden and appear as blanks.

Follow these steps to hide zero values for an entire sheet.

  1. Go to the File tab.
  2. Select Options in the bottom left of the backstage area.

This will open the Excel Options menu which contains a variety of customizable settings for your Excel app.

  1. Go to the Advanced tab in the Excel Options menu.
  2. Scroll down to the Display options for this worksheet section.
  3. Select the sheet on which you want to hide your zero values.
  4. Uncheck the Show a zero in cells that have zero value option.
  5. Press the OK button.

📝 Note: This option is checked by default for any new sheet in your workbook. You will have to update this setting for each sheet if you want hidden zeros across your entire workbook.

All your zero values are now hidden across the entire sheet!

If you want to show a few zeros in such a sheet, it is still possible. You can use this #,##0;-#,##0;0 custom format to override the setting on individual cells.

Show Zero as Blank with the TEXT Function

You can also use the same custom format strings with an Excel function.

The TEXT function allows you to format numbers as text and apply any special format.

= TEXT ( C3, "$#,##0;-$#,##0;" )

The above formula will format the content of cell C3 based on the supplied format where zero values are hidden. The "$#,##0;-$#,##0;" format string is the exact same as the custom format solution.

The results from this formula will be text values, so this may not be the ideal solution depending on what you need to do with the formatted values. You won’t be able to use the results in any further numerical calculations since they are text.

Show Zero as Blank with the IF Function

You can also use the IF function to hide any zero values.

You can test if a cell has a zero value and show a blank when it does.

= IF ( C3=0, "", C3 )

The above formula will test if the value in cell C3 is zero and return the empty string "" if it is. Otherwise, it will return the original value.

This will keep the non-zero values as numbers, but the blank cells will actually be text values.

Show Zero as Blank with Find and Replace

You might decide you want to remove the zero values from your data entirely.

This is possible to do with a simple find and replace. You can search for the zeros and then replace them with a blank. This way you will have truly blank cells instead of zeros.

Follow these steps to replace your zero values from any range.

  1. Select the cells from which you want to remove zeros.
  2. Press Ctrl + H to open the Find and Replace menu.
  1. Add 0 to the Find what input.
  2. Leave the Replace with input empty.

This will essentially remove all the zeros from your values because you will find all the 0 cells and replace them with nothing!

  1. Check the option to Match entire cell contents.

This is a key part of the process. Matching the entire cell contents means you won’t inadvertently change a value such as 520 to 52.

  1. Press the Replace All button.

Excel will replace all the zero values in your selection with a blank.

Show Zero as Blank in Power Query

Power Query is an amazing tool in Excel for any sort of data import or transformation task.

You will easily be able to remove any zeros and replace them with blanks in your queries.

You will first need to get your data into the Power Query editor.

  1. Select your dataset.
  2. Go to the Data tab.
  3. Press the From Table/Range command to import the data into Power Query.

This will open up the Power Query editor with your data.

  1. Click on the column heading containing the zeros to replace.
  2. Go to the Transform tab.
  3. Press the Replace Values command.

This will open the Replace Values menu where you will be able to define what to find and what to replace it with.

  1. Enter 0 in the Value To Find input.
  2. Enter null in the Replace With input.
  3. Press the OK button.

📝 Note: The null value is Power Query’s equivalent to a blank in Excel. It represents the absence of a value.

= Table.ReplaceValue(#"Changed Type",0,null,Replacer.ReplaceValue,{"Sales"})

You will notice data now shows null values instead of any zeros. Power Query has performed this by automatically creating an M code formula like the above.

You can now load the data back into Excel. Go to the Home tab and click on Close and Load.

The data can be loaded into a table in a location of your choice and the null values will show as blanks.

📝 Note: This is a great option for any data that will be continually updated, as you can refresh the query and the results for the new data will appear! Go to the Data tab and use the Refresh All command to rerun the query.

Show Zero as Blank with VBA

VBA is a great way to automate most tasks in Excel.

You can use VBA to remove zeros as well in a similar fashion to the Find and Replace feature. But this way you won’t need to input any values to find, or update settings to get the job done. The code will take care of that!

You can create a macro that will loop through the selected range and identify any cells with a zero and remove them.

Follow these steps to open the visual basic editor.

  1. Go to the Developer tab.
  2. Select the Visual Basic command to open the editor.

You might not see the Developer tab, as it’s hidden by default. You can enable the Developer tab in your ribbon if you don’t see it already. You can also use the Alt + F11 keyboard shortcut to directly open the visual basic editor.

  1. Go to the Insert menu of the visual basic editor.
  2. Select the Module option.
Sub RemoveZeros()
Dim selectedRange As Range
Set selectedRange = Application.Selection

For Each i In selectedRange.Cells
    If i.Value = 0 Then
        i.Clear
    End If
Next i
End Sub

This will create a new module where you can copy and paste the above code.

This code will loop through each cell in the selected range and check if its value is zero. If the value is zero then the cell content is cleared. This will remove the zero entirely and not just hide it from view.

Now you can select any range in the workbook and run the VBA code to remove the zeros!

Show Zero as Blank with Office Scripts

VBA isn’t the only way to automate things in Excel. You can also use Office Scripts if you’re using Excel online with a Microsoft 365 business plan.

Open your Excel workbook in the web browser and go to the Automate tab then select the New Script option.

function main(workbook: ExcelScript.Workbook) {
  let range = workbook.getSelectedRange();
  let rowCount = range.getRowCount();
  let colCount = range.getColumnCount();

  for (let row = 0; row < rowCount; row++) {
    for (let col = 0; col < colCount; col++) {
      let currCell = range.getCell(row, col);
      let currValue = currCell.getValue();
      if (currValue == 0) {
        currCell.clear(ExcelScript.ClearApplyTo.contents);
      };
    };
  };
}

This will open the Code Editor on the right side of the workbook. You can then copy and paste the above code into the Code Editor and press the Save script button.

This code will loop through the selected range and clear the content of any cell that contains a zero.

Select the range with zeros and press the Run button in the Code Editor and your zeros will be removed leaving you with blank cells in their place.

Conclusions

There are many reasons why you might want to hide the zeros in your Excel workbooks. Displaying your zeros as blanks can help visually declutter your data and improve readability.

Excel has several great ways to hide zeros. You can apply custom formats, use the Excel Options menu, or use functions such as TEXT and IF.

Another option might be to remove any zero values from your data. This can be achieved quickly with Find and Replace, VBA, or Office Scripts.

If you are importing or transforming your data on a frequent basis, then Power Query should be your go-to method and you will also be able to remove any zero values in your query.

Do you hide the zeros in your workbook? What methods do you use? Let me know in the comments below!

About the Author

John MacDougall

John MacDougall

John is a Microsoft MVP and qualified actuary with over 15 years of experience. He has worked in a variety of industries, including insurance, ad tech, and most recently Power Platform consulting. He is a keen problem solver and has a passion for using technology to make businesses more efficient.

Related Posts

Comments

0 Comments

Get the Latest Microsoft Excel Tips

Follow Us

Follow us to stay up to date with the latest in Microsoft Excel!

Subscribe for awesome Microsoft Excel videos 😃