Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Displaying a Count of Zeros on the Status Bar.

Displaying a Count of Zeros on the Status Bar

by Allen Wyatt
(last updated November 4, 2016)

3

Jeremy's company is often interested in how many cells contain the value zero. He wonders if there is a way to customize the status bar to automatically display the COUNTIF formula. He knows he can see the results of functions such as AVERAGE, COUNT, SUM and others, but can't find a way to do a more complex COUNTIF display.

Unfortunately there is no way to modify the default functions available on the status bar. There are, however, some workarounds that you can consider. The obvious is to use a formula in a cell to evaluate the number of zeros in a range:

=COUNTIF(A1:E52,0)

You could also select the desired range and use the Find tool (Ctrl+F) to search for the number 0. If you click on Find All, the dialog box reports the number of occurrences in the selected range—the number of zeros.

If you prefer, you can create a short macro that will do the calculation and display it on the status bar. The following is an example of a macro that is run every time the selection is changed in the worksheet.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    zCount = Application.WorksheetFunction.CountIf(Target.Cells,0)
    Application.StatusBar = "Selection has " & CStr(zCount) & " zeros"
End Sub

All you need to do is make sure that you place this code within the code module for the worksheet you want affected. (Just right-click the worksheet's tab and choose View Code from the resulting Context menu. That's where the code should be placed.)

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12511) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Displaying a Count of Zeros on the Status Bar.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Read-Only Files

Read-only documents (those that cannot be updated) are part and parcel of working with Word. There are many ways that a ...

Discover More

Creating Custom AutoText Categories

Want to categorize your AutoText entries? You can easily do so using the techniques described in this tip.

Discover More

Displaying a Hidden First Column

Hiding columns is easy, even hiding column A. How, then, do you get that left-most column displayed again? Here are a few ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (ribbon)

Disabling a Function Key

Function keys are used to perform common tasks in Excel. If you want to disable one of the function keys, it's rather easy to ...

Discover More

Making AutoComplete Work for an Entire Column

AutoComplete is a great feature for quickly adding data to a worksheet. If you are confused by why some things are picked up ...

Discover More

Controlling Automatic Backups

Excel can make backups whenever you save your workbook. If you want to turn the feature on or off, this tip explains how to ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 8Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 6 - 3?

2016-11-05 05:31:51

Michael (Micky) Avidan

@Chris,
You bursted into an open door.
I waited for Allen to get the point and to correct the above tip.
--------------------------
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2017)
ISRAEL


2016-11-04 12:35:35

Chris

@Micky
To mitigate some of the danger in the find tool you can click the Options button and place a check mark in the box near "Match entire cell contents".

Depending on other factors, it may be beneficial to "Look in Values" also.


2016-11-04 09:48:49

Michael (Micky) Avidan

@Allen,
the use of the "Find tool" is a bit dangerous because it will also find and count the "zeros" in 10, 205 etc'
--------------------------
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2017)
ISRAEL


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.