See the attached which uses VBA
Formula in C2 (C1 is set to 2 to avoid colour index of 2 which is white)
=IF(AND(COUNTIF($B$2:$B$33,B2)>1,COUNTIF($B$2:$B2,$B2)=1),MAX($C$1:C1)+1,IFERROR(INDEX($C$1:$C1,MATCH($B2,$B$2:$B$33,0)+1),""))
The first part finds the FIRST occurence of a duplicate date and it is flagged with a number.
The second part finds the corresponding number when we find the matching date(s) and allocates the corresponding number.
The VBA code then fills in colour for matching dates.
Click on button to run macro
Column B (with the dates) is a named range called "Date_List"
NOTE: there is a limit of 56 colour codes.
Bookmarks