Hi Berly,
I've tried to recreate your sheet and come up with a formula for each group, hopefully they work but I'm not entirely sure as I don't have access to your sheet, I just recreated it to the best of my ability.
For Group A (ie, you would put this in cell E3 and then drag it down), try:
=IF(OR(TEXT(D3, "ddd")="Sat", TEXT(D3, "ddd")="Sun"), "Off", VLOOKUP(TEXT(D3, "ddd"), I4:J10, 2, FALSE))
For Group B:
=IF(TEXT(D3, "ddd")="Sat", INDEX(I10:J11, 1, 2), IF(TEXT(D3, "ddd")="Sun", INDEX(I10:J11, 2, 2), INDEX(I10:J11, MOD(ROUNDUP((D3-$D$3)/2,0),2)+1, 2)))
I hope these solutions work, but if not, feel free to let me know and I'll have another go. It might also be easier if you can share a version of the document with me, but just be careful that your data is anonymized if that matters in this context.
Kind regards,
nt1809