Hi, welcome to the forum

if all you are doing, is testing to see if A contains Y, then why not just...
=IF(A2="y",AVERAGE(B2:M2),"")

The way you are doing it, it is ONLY looking ar B2 for the avg