Written by Allen Wyatt (last updated October 13, 2018)
This tip applies to Excel 97, 2000, 2002, and 2003
Sanjib would like to get a count of all the comments in a worksheet. Unfortunately, Excel doesn't include a function that allows you to access this information. You can, however, get the value manually by using this process:
Figure 1. The Go To Special dialog box.
If you want to get the number of comments and place it into a cell, then you need to use a macro to create a user-defined function.
Function CountComments(rCell As Range) Application.Volatile CountComments = rCell.Parent.Comments.Count End Function
This function grabs the value of the Count property for the Comments collection. It is then returned by the function to the worksheet. To use it in your worksheet, enter a formula such as the following:
=CountComments(A1)
The cell address you use in the formula is unimportant; it should simply reference a cell on the worksheet for which you want the count.
Note:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (6932) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Counting Comments in a Worksheet.
Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!
Adding a comment to a single cell is easy. What if you want to add the same comment to multiple cells, however? Here are ...
Discover MoreComments can be very helpful in a worksheet. After they are added, you may want to change what they contain. Here's how ...
Discover MoreThere are three different ways that Excel allows you to display any comments that are in your worksheet. Here's how you ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2020-01-25 08:44:56
Fiaz Idris
There is a problem with the count using status bar. When the Cell is Empty but with comments, that cell is NOT counted.
So, you will receive less count than the actual number of comments in cases.
To avoid this problem, after Step 4, when all the cells are selected, Type: "aaa" (some random text), and press Ctrl+Enter. This will add text "aaa" to all the comment cells.
Now every comment cell has a value and the count of comments will now be correct in status bar. Hope this helps!
2018-10-13 11:17:06
Rick Rothstein
There is no need to include the Application.Volatile code line as inserting and deleting comments does not trigger any events that Excel monitors, so your CountComments formula will work like Excel's CELL function... it will not update until the worksheet is recalculated.
Also, you can eliminate the need for having to pass a cell reference to the function by making use of the Application.Caller object. The following function will work like the one you posted, but no argument should be passed to it.
Function CountComments() As Long
CountComments = Application.Caller.Parent.Comments.Count
End Function
And you would simply call it like this...
=CountComments()
Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2023 Sharon Parq Associates, Inc.
Comments