In C55, array-entered (means committing the formula to the sheet with Ctrl+Shift+Enter, not just Enter)
=AVERAGE(IF(((DATESONLY>=TODAY()-G55)*(HOUR(DATESONLY)<=12))>0,INDIRECT(B$2)))
and in D55:
=AVERAGE(IF(((DATESONLY>=TODAY()-G55)*(HOUR(DATESONLY)>12))>0,INDIRECT(B$2)))
, copied down
Note that the only difference is <=12 and >12. You may want to tweak this depending on how you define AM and PM hours to <12 and >=12, but note also that only one of these formula should contain an = sign, otherwise you could be including some numbers in both AM and PM averages, and if you don't include an = sign in either you'll be missing out noon values from both averages.