Count cells based on color
I had made an Excel Sheet, and I had colored the cells for status. Like Red=Bad, Green=Good, Yellow=ToBeConfirmed, etc. Now after spending long time, I wanted to count number of cells based on color. I googled a lot, and there was no single function to do this based on color. If I had used some text instead of color, life would have been much easier. Anyways, there is a small workaround to do this. As Excel does NOT have any native way of doing this, we must create our own custom function to do it. We will first define our custom function. Press ALT+F11 to open vb editor, right-click "This Workbook" and "Insert" --> "Module" and paste the code below in there (no changes needed). Function FNcountcolor(myrange As Range, colour As Range) As Long Dim n as Range Application.Volatile For Each n In myrange If n.Interior.ColorIndex = colour.Interior.ColorIndex Then FNcountcolor = FNcountcolor + 1 ...