Forum Discussion
Sheriffg84
Jan 10, 2020Copper Contributor
Count By Color with Conditional Formatting
What I'm trying to do is quickly and automatically figure out how many employees I have scheduled for each quarter hour. I am so close to completing this project but I have one issue to overcome. I h...
- Jan 14, 2020
You may mark it as a "Best solution". Then you'll make me really happy. Haha!
Riny_van_Eekelen
Platinum Contributor
I wonder why you would go so long as to try counting cells based on format using VBA. Perhaps you want to consider a different approach. Enter the following formula in D2 and copy it down and across.
=IFERROR(1/(AND($B2<>"",$C2<>"")/AND(D$1>=$B2,D$1<$C2)),"")
It will test if start and stop times are entered and return a blank for quarters not scheduled and 1 for those that are. In row 17 you can then simply sum the cells above. Add conditional formatting to your liking.
Sheriffg84
Jan 13, 2020Copper Contributor
I ended up using =COUNTIFS($B$2:$B$15,"<="&Y1,$C$2:$C$15,">="&Y1) for each quarter hour. I kept the post up because I noticed when searching for my own solution to counting conditionally formatted cells there were other who had the same type of question.