Загрузка данных


Function SumByColor(DataRange As Range, ColorCell As Range) As Double
    Dim Cell As Range
    Dim Total As Double
    
    For Each Cell In DataRange
        If Cell.Interior.Color = ColorCell.Interior.Color Then
            If IsNumeric(Cell.Value) Then
                Total = Total + Cell.Value
            End If
        End If
    Next Cell
    
    SumByColor = Total
End Function