While COUNTIF itself doesn’t directly count cells by color, you can use conditional formatting to highlight cells with a specific color.
May these articles help you:
https://www.howtoexcel.org/count-colored-cells/
https://www.exceldemy.com/excel-formula-to-count-cells-with-specific-color/
** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful **