I dont think you can do this without using VBA to identify the color index of the cell colour you are interested in. An Excel function can then be used to count the colours.
I got this off the internet to save time, the function and how to use it are included with your spreadsheet.
You end up (in cell B2) with a function =colorfunction($A$2,B3:B13,FALSE) ..copied across
Where $A$2 is the address of the cell whose colour you are interested in (it reads the index of this colour). (For the pink ones)
where B3:B13 is the range of cells you want to count over
FALSE is a switch which means count the colours.
or TRUE means sum the values of the contents of the coloured cells.
For the yellow it is ( in cell z2) =colorfunction($Y$2,Z3:Z13,FALSE) ..copied across
Here is where I got it:-
https://www.extendoffice.com/documents/excel/1155-excel-count-sum-cells-by-color.html
your file:-
https://www.mediafire.com/file/i22d3izn91opwod/COLOR.xlsm/file
Have a look and see what you think.
Frank