Custom Function - LET or LAMDA?

Copper Contributor

I have a custom function to sum based upon interior color of a cell that works.   Can this formula be mimicked by using LET or LAMBDA?   If so.. how?

 

Function ColorSum(myrange As Range, mycolorindex As Integer) As Double
    Dim c As Range
    On Error Resume Next
    For Each c In myrange.Cells
        If c.Interior.ColorIndex = mycolorindex Then _
          ColorSum = ColorSum + c.Value
    Next
End Function
 
 
2 Replies
May be not! If those colors are formatted by conditional formatting then it would be possible otherwise VBA is only option.

@squid2023 

In addition, any function works with cell value only. If you'd like to work with cell properties like colour, that's VBA or Office Script.