See if this will get you heading in the right direction. The formula below will find the date and to the test for you, you just need to finish it off with the ABC part....

=VLOOKUP($B$1,'Pay Calendars'!$A$2:$C$27,3,0)<=DATE(2014,MONTH($B$3),DAY($B$3))+3