How do I count cells with in a range in excel with specific value that has a comment using vba or formula?
up vote
1
down vote
favorite
I need help on this. I'm doing a report and inserting comments on cells. How do I count cells with in a range in excel with specific value that has a comment using vba or formula?
excel-vba vba excel
add a comment |
up vote
1
down vote
favorite
I need help on this. I'm doing a report and inserting comments on cells. How do I count cells with in a range in excel with specific value that has a comment using vba or formula?
excel-vba vba excel
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I need help on this. I'm doing a report and inserting comments on cells. How do I count cells with in a range in excel with specific value that has a comment using vba or formula?
excel-vba vba excel
I need help on this. I'm doing a report and inserting comments on cells. How do I count cells with in a range in excel with specific value that has a comment using vba or formula?
excel-vba vba excel
excel-vba vba excel
edited Jul 9 at 19:34
Community♦
11
11
asked Nov 4 '15 at 19:33
DMac
83
83
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
accepted
Here is one way. It loops through each cell you pass in the range and checks if there is a comment. If so, it adds it to a counter. This is probably going to be pretty expensive if used on large range, but it should at least get you started:
Add to a regular module:
Function CommentCounter(rng As Range) As Integer
Dim cell As Range
Dim counter As Integer
Dim currentComment As String
For Each cell In rng
On Error Resume Next
currentComment = cell.Comment.Text
If Len(currentComment) > 0 Then counter = counter + 1
currentComment = ""
Next cell
CommentCounter = counter
End Function
Just saw the part about having a specific value AND a comment. This should get you going:
Function CommentCounter(rng As Range) As Integer
Dim cell As Range
Dim counter As Integer
Dim currentComment As String
Dim specificValue As String
specificValue = "Something Specific"
For Each cell In rng
On Error Resume Next
currentComment = cell.Comment.Text
If cell.Value = specificValue And Len(currentComment) > 0 Then counter = counter + 1
currentComment = ""
Next cell
CommentCounter = counter
End Function
It worked! thanks a lot!
– DMac
Nov 5 '15 at 16:57
add a comment |
up vote
0
down vote
=COUNTIF(A:A;"comment")
Where A:A specifies that you want to examine the whole column of A. Instead of A:A, you could also use A1:A3, which means examine A1, A2 and A3.
EDIT:
If you want to count the cells with comments (not with the word "comment"), I would suggest to do the following:
=COUNT(A1:A3) - COUNTBLANK(A1:A3)
i don't think the OP means has the word "comment" in a cell, but is actually a comment (little red triangle @ the top right of the cell).
– sous2817
Nov 4 '15 at 19:43
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Here is one way. It loops through each cell you pass in the range and checks if there is a comment. If so, it adds it to a counter. This is probably going to be pretty expensive if used on large range, but it should at least get you started:
Add to a regular module:
Function CommentCounter(rng As Range) As Integer
Dim cell As Range
Dim counter As Integer
Dim currentComment As String
For Each cell In rng
On Error Resume Next
currentComment = cell.Comment.Text
If Len(currentComment) > 0 Then counter = counter + 1
currentComment = ""
Next cell
CommentCounter = counter
End Function
Just saw the part about having a specific value AND a comment. This should get you going:
Function CommentCounter(rng As Range) As Integer
Dim cell As Range
Dim counter As Integer
Dim currentComment As String
Dim specificValue As String
specificValue = "Something Specific"
For Each cell In rng
On Error Resume Next
currentComment = cell.Comment.Text
If cell.Value = specificValue And Len(currentComment) > 0 Then counter = counter + 1
currentComment = ""
Next cell
CommentCounter = counter
End Function
It worked! thanks a lot!
– DMac
Nov 5 '15 at 16:57
add a comment |
up vote
1
down vote
accepted
Here is one way. It loops through each cell you pass in the range and checks if there is a comment. If so, it adds it to a counter. This is probably going to be pretty expensive if used on large range, but it should at least get you started:
Add to a regular module:
Function CommentCounter(rng As Range) As Integer
Dim cell As Range
Dim counter As Integer
Dim currentComment As String
For Each cell In rng
On Error Resume Next
currentComment = cell.Comment.Text
If Len(currentComment) > 0 Then counter = counter + 1
currentComment = ""
Next cell
CommentCounter = counter
End Function
Just saw the part about having a specific value AND a comment. This should get you going:
Function CommentCounter(rng As Range) As Integer
Dim cell As Range
Dim counter As Integer
Dim currentComment As String
Dim specificValue As String
specificValue = "Something Specific"
For Each cell In rng
On Error Resume Next
currentComment = cell.Comment.Text
If cell.Value = specificValue And Len(currentComment) > 0 Then counter = counter + 1
currentComment = ""
Next cell
CommentCounter = counter
End Function
It worked! thanks a lot!
– DMac
Nov 5 '15 at 16:57
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Here is one way. It loops through each cell you pass in the range and checks if there is a comment. If so, it adds it to a counter. This is probably going to be pretty expensive if used on large range, but it should at least get you started:
Add to a regular module:
Function CommentCounter(rng As Range) As Integer
Dim cell As Range
Dim counter As Integer
Dim currentComment As String
For Each cell In rng
On Error Resume Next
currentComment = cell.Comment.Text
If Len(currentComment) > 0 Then counter = counter + 1
currentComment = ""
Next cell
CommentCounter = counter
End Function
Just saw the part about having a specific value AND a comment. This should get you going:
Function CommentCounter(rng As Range) As Integer
Dim cell As Range
Dim counter As Integer
Dim currentComment As String
Dim specificValue As String
specificValue = "Something Specific"
For Each cell In rng
On Error Resume Next
currentComment = cell.Comment.Text
If cell.Value = specificValue And Len(currentComment) > 0 Then counter = counter + 1
currentComment = ""
Next cell
CommentCounter = counter
End Function
Here is one way. It loops through each cell you pass in the range and checks if there is a comment. If so, it adds it to a counter. This is probably going to be pretty expensive if used on large range, but it should at least get you started:
Add to a regular module:
Function CommentCounter(rng As Range) As Integer
Dim cell As Range
Dim counter As Integer
Dim currentComment As String
For Each cell In rng
On Error Resume Next
currentComment = cell.Comment.Text
If Len(currentComment) > 0 Then counter = counter + 1
currentComment = ""
Next cell
CommentCounter = counter
End Function
Just saw the part about having a specific value AND a comment. This should get you going:
Function CommentCounter(rng As Range) As Integer
Dim cell As Range
Dim counter As Integer
Dim currentComment As String
Dim specificValue As String
specificValue = "Something Specific"
For Each cell In rng
On Error Resume Next
currentComment = cell.Comment.Text
If cell.Value = specificValue And Len(currentComment) > 0 Then counter = counter + 1
currentComment = ""
Next cell
CommentCounter = counter
End Function
answered Nov 4 '15 at 19:53
sous2817
3,40222330
3,40222330
It worked! thanks a lot!
– DMac
Nov 5 '15 at 16:57
add a comment |
It worked! thanks a lot!
– DMac
Nov 5 '15 at 16:57
It worked! thanks a lot!
– DMac
Nov 5 '15 at 16:57
It worked! thanks a lot!
– DMac
Nov 5 '15 at 16:57
add a comment |
up vote
0
down vote
=COUNTIF(A:A;"comment")
Where A:A specifies that you want to examine the whole column of A. Instead of A:A, you could also use A1:A3, which means examine A1, A2 and A3.
EDIT:
If you want to count the cells with comments (not with the word "comment"), I would suggest to do the following:
=COUNT(A1:A3) - COUNTBLANK(A1:A3)
i don't think the OP means has the word "comment" in a cell, but is actually a comment (little red triangle @ the top right of the cell).
– sous2817
Nov 4 '15 at 19:43
add a comment |
up vote
0
down vote
=COUNTIF(A:A;"comment")
Where A:A specifies that you want to examine the whole column of A. Instead of A:A, you could also use A1:A3, which means examine A1, A2 and A3.
EDIT:
If you want to count the cells with comments (not with the word "comment"), I would suggest to do the following:
=COUNT(A1:A3) - COUNTBLANK(A1:A3)
i don't think the OP means has the word "comment" in a cell, but is actually a comment (little red triangle @ the top right of the cell).
– sous2817
Nov 4 '15 at 19:43
add a comment |
up vote
0
down vote
up vote
0
down vote
=COUNTIF(A:A;"comment")
Where A:A specifies that you want to examine the whole column of A. Instead of A:A, you could also use A1:A3, which means examine A1, A2 and A3.
EDIT:
If you want to count the cells with comments (not with the word "comment"), I would suggest to do the following:
=COUNT(A1:A3) - COUNTBLANK(A1:A3)
=COUNTIF(A:A;"comment")
Where A:A specifies that you want to examine the whole column of A. Instead of A:A, you could also use A1:A3, which means examine A1, A2 and A3.
EDIT:
If you want to count the cells with comments (not with the word "comment"), I would suggest to do the following:
=COUNT(A1:A3) - COUNTBLANK(A1:A3)
edited Nov 4 '15 at 19:46
answered Nov 4 '15 at 19:40
Pieter van der Heijden
1467
1467
i don't think the OP means has the word "comment" in a cell, but is actually a comment (little red triangle @ the top right of the cell).
– sous2817
Nov 4 '15 at 19:43
add a comment |
i don't think the OP means has the word "comment" in a cell, but is actually a comment (little red triangle @ the top right of the cell).
– sous2817
Nov 4 '15 at 19:43
i don't think the OP means has the word "comment" in a cell, but is actually a comment (little red triangle @ the top right of the cell).
– sous2817
Nov 4 '15 at 19:43
i don't think the OP means has the word "comment" in a cell, but is actually a comment (little red triangle @ the top right of the cell).
– sous2817
Nov 4 '15 at 19:43
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f33530472%2fhow-do-i-count-cells-with-in-a-range-in-excel-with-specific-value-that-has-a-com%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown