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

Item Not Available in Library

When sharing workbooks with others, you may find that the macros in those workbooks may not work as you expect. This tip ...

Discover More

Tying Workbooks Together

If you work with multiple workbooks at the same time, you might wonder how to tie them together so they open and close and ...

Discover More

Comparing Strings

When writing a macro, a common task is the need to compare two strings. You can do this by "normalizing" the strings, as ...

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)

Excel Self-Tests

Need to find out how good you are with Excel? Here are some places you can check out to quiz yourself.

Discover More

Relative Worksheet References

Copy a formula from one place to another and Excel helpfully adjusts the cell references within the formula. That is, it ...

Discover More

Seeing Excel's Program Window

Have you ever opened Excel to find that the window you saw yesterday is not the same as it is today? Sometimes, for various ...

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 6Mpixels. 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 7 - 1?

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.