I have a custom formula which returns a colour code based on the background colour of a cell.
Function GetFillColor(Rng As Range) As Long
GetFillColor = Rng.Interior.ColorIndex
End Function
The below works fine and returns 15 (which is the colour code of my cell).
=GetFillColor(AD3)
This works within in 'if' function if I use the function for a single cell for example and it returns 1.
=IF(GetFillColor(AD3)=15,1,0)
However if I try to reference within a countif function it doesnt work.
=COUNTIF(AC3:AD3,GetFillColor()=15)
I'm not sure how to reference the range within the function.