Excel does not have a native function to sum cells by color. This guide shows you how to automate this using a custom VBA function.
Le faire avec l'IAOpen the VBA Editor
Press ALT + F11 to open the editor, go to Insert > Module, and paste the custom function code.
Insert the VBA Code
Paste the function that identifies the color index and sums the range based on that index.
Use the Custom Function
Return to your worksheet and type =SumByColor(range, color_cell) to calculate the total.
Function SumByColor(rng As Range, cellColor As Range) As DoubleNo, this VBA method only detects manually applied cell colors, not those set by Conditional Formatting.