Forum Discussion
BeckyBo334
Jan 25, 2024Copper Contributor
Can someone help me create the correct formula
Hi. I need help getting the formula correct. I need to count the number occurrences of blue, green, purple, and blank cells. Am I even using the right function? If the function is right, what am I en...
Mayukh_Bhattacharya
Jan 25, 2024Iron Contributor
BeckyBo334 it will be helpful, if you read the MSFT Documentations once before applying the function. However, you could use one of the followings, also instead of hardcoding the colors count needed place them in some range and use it as a reference like shown below.
Using COUNTIF() , SUM() & HSTACK()
=SUM(COUNTIF(D2:D12,HSTACK("blue","green","purple","")))
Or, Color refers to range F6:F8 (you may need to change the cell range as per your suit)
=SUM(COUNTIF(D2:D12,Color))