Forum Discussion
jklei1895
Feb 13, 2022Copper Contributor
Count if color
Trying to use countifcolor function and its not listed in my excel functions. Using Microsoft 365, ver 2201 What do I need to do?
JMB17
Feb 13, 2022Bronze Contributor
As already stated, there's no such function. Color is not really data, but more like metadata (in Excel, at least) - it's more for the user's benefit when viewing the worksheet and not so much for excel to use in formula logic. But, perhaps whatever logic you are using to color your cells could be used in a countif formula - assuming the logic is based on your data.
You could use vba to do it (either as an event handler, or as a user-defined function), but you'll always have to perform some action to get it to re-calculate (whether by some worksheet event such as Niko's selectionchange code, or by triggering/forcing excel to re-calculate) - changing a cell color, by itself, doesn't trigger excel to re-calculate or trigger any events.
You could use vba to do it (either as an event handler, or as a user-defined function), but you'll always have to perform some action to get it to re-calculate (whether by some worksheet event such as Niko's selectionchange code, or by triggering/forcing excel to re-calculate) - changing a cell color, by itself, doesn't trigger excel to re-calculate or trigger any events.