Forum Discussion
Gianni Emmanuel Trossero
Jul 12, 2018Copper Contributor
sumar.si
Hi people! I would like to know how to use the formula sumar.si to add values that are in cells color Green(for example). Ty
Buddhadeb de
Jul 15, 2018Copper Contributor
Hi
i have same kind report where need to do same task so i was made custom function in VBA and i have save as like excel add-in . so i hope it will help .
below code need to add in VBA its working fine.
Function getsumbycolor(lookupcolor As Range, lookuparray As Range) As LongLong
Dim colorsum As LongLong
Dim colornumber As LongLong
Dim rg As Range
colorsum = 0
colornumber = lookupcolor.Interior.Color
For Each rg In lookuparray
If rg.Interior.Color = colornumber Then
colorsum = colorsum + rg.Value
End If
Next rg
getsumbycolor = colorsum
End Function
Thanks
Buddhadeb De