Yes, this would be for sheet 4 =IF(D4="M",IF(SUM('4'!$O$32:$O$42)>=5,"Yes",IF('4'!$O$32>=1,"Yes","No"))) and return argument in S4 (D4=A)
this would be for sheet 5 =IF(D5="M",IF(SUM('5'!$O$32:$O$42)>=5,"Yes",IF('5'!$O$32>=1,"Yes","No"))) and return argument in S5 (D5=M)
Yes, in pseudocode, that is the correct logic.
S4 should be yes when Sheet for O32 >=1