How to set the criteria to sumif only cells that are highlighted

New Contributor

what do you enter as the criteria in the sumif function when you want to sum only cells that are highlighted

2 Replies


If the cells are highlighted using conditional formatting, refer to the condition(s) of the conditional formatting rule instead of to the cell color.

If the cells have been colored manually, you'll need to use VBA: see for example 

@Hans Vogelaar Thank you very much for you prompt assistance.