Try this formula in cell M2
=IF(COUNTIF(H2:L2,40)+COUNTIF(H2:L2,35)>=3,"Yes","No")
This formula returns "Yes" if there are 3 or more instances of 35 or 40 in the range H2:L2.
i.e. 35 40 21 40 23 would return "Yes"
The next formula should be used if you want to return a "Yes" if 3 or more...