Quote:
Originally Posted by Claus Busch
Hi Phillip,
Am Thu, 22 Sep 2016 13:49:33 +0100 schrieb phillip cole:
I would like to sum a range of cells in a column that have specific text
in the comments and display the sum at the bottom of each column. I
have multiple columns i would like to add up. Is this possible using
text in comments?
try following function:
Function ComSum(myRng As Range)
Dim rngC As Range
For Each rngC In myRng
If Not rngC.Comment Is Nothing Then
If Left(rngC.Comment.Text, 1) = "M" Then
ComSum = ComSum + rngC.Value
End If
End If
Next
End Function
and call it in the sheet e.g. with
=ComSum(F2:F4)
Regards
Claus B.
--
Windows10
Office 2016
|
Thank you Claus,
I copied and pasted that to a module in my spreadsheet. then i set the "sum" cell at the bottom of each column to e.g. "=ComSum(AE720:AE722)". I selected the whole data table and named the range "myRng". It is definitely getting me moving in the right direction but i'm getting some funny results. sometimes its adding the comments with "M". Sometime its adding up all the letters in the cells with comments but putting it in as "MM" versus "2". Sometimes it's not returning a sum if i have letters in the cell "AT" and a comment of "M".
i have attached the results and some other information.
Thoughts?
Thank you