Skip to main content

How to count number of cells with comments in Excel?

Author: Xiaoyang Last Modified: 2014-09-29

Have you ever tried to count the number of comments in a worksheet? In this article, I will introduce you some quick tricks to count how many cells with comments in a worksheet.

Count number of cells containing comments with Go To Special function

Count number of cells containing comments with User Defined Function

Count number of cells containing comments with VBA code


arrow blue right bubble Count number of cells containing comments with Go To Special function

With the Go To Special feature in Excel, you can select all the comment cells first, and then view the count number in the status bar.

1. Go to click Home > Find & Select > Go To Special, see screenshot:

doc-count-comments-1

2. In the Go To Special dialog box, please check Comments option under Select section, see screenshot:

doc-count-comments-1

3. Then click OK button to close this dialog, and all the cells in active worksheet which contain the comment have been selected at once. And you can get the count number of the comments at the status bar. See screenshot:

doc-count-comments-1

Note: If you have blank cells with comments, the blank cell comments will not be counted.

Tip: You also can press Ctrl + G shortcuts to open Go To dialog, and click Special button to show Go To Special dialog.


arrow blue right bubble Count number of cells containing comments with User Defined Function

The above method has its own disadvantage, so, we can create a User Defined Function to count all the cell comments including the blank cell comments.

1. Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste the following code in the Module Window.

VBA code: Count number of cells with comment

Function CountComments(xCell As Range)
'Update 20140924
    Application.Volatile
    CountComments = xCell.Parent.Comments.Count
End Function

3. Then save and close the code, go back to the worksheet, in a blank cell please enter this formula: =countcomments(A1), (A1 is a cell reference, you can change it to any other cell address ), see screenshot:

doc-count-comments-1

4. Then press Enter key, and you will get the number of cell comments.


arrow blue right bubble Count number of cells containing comments with VBA code

The following VBA code also can help you tocount all the cell comments including the blank cell comments.

1. Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste the following code in the Module Window.

VBA code: Count number of cells with comment

Sub CountComments()
'Update 20140924
Dim Rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Set WorkRng = WorkRng.SpecialCells(xlCellTypeComments)
If VBA.Err > 0 Then
    MsgBox 0
Else
    MsgBox WorkRng.Count
End If
End Sub

3. Then press F5 key to run this code, and a prompt box will pop out to remind you to select a data range that you want to count the cell comments. See screenshot:

doc-count-comments-1

4. And then click OK, you will get the number of cell comments in the selection.

doc-count-comments-1


Related articles:

How to list all comments to a new worksheet or workbook in Excel?

How to find and replace text within comments in Excel?

How to quickly insert a comment to multiple cells in Excel?

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

Description


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Comments (2)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Buenas tardes, me puede colaborar, que hacer para contar las celdas con comentarios dentro de un rango con Application.Volatile
This comment was minimized by the moderator on the site
sorry to say.. 9 of 10 times need the short 1 line answer. all this fancy dimm rap / buring the item need is just apita
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations