View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default sum cells with specific text in comments

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