- sum by color excel
- sum by color vba
- excel formula to sum colored cells
- colorfunction excel
Function SumByColor(CellColor As Range, rRange As Range)
Dim cSum As Long
Dim ColIndex As Integer
ColIndex = CellColor.Interior.ColorIndex
For Each cl In rRange
If cl.Interior.ColorIndex = ColIndex Then
cSum = WorksheetFunction.SUM(cl, cSum)
End If
Next cl
SumByColor = cSum
End Function
Steps:
- Copy and paste the code in your personal.XLSB modules
- In your spreadsheet, in any cells that you want to insert SumByColor formula, call above Function by using 'Insert Function' then select 'User Defined' category
- Select a function: PERSONAL.XLSB!SumByColor
- Select Color cell
- Select Range to SUM
No comments:
Post a Comment