I believe previous formula should be:

=AVERAGE(OFFSET(A4:L4,0,MAX(IF(($U$4:$AZ$16<>0),COLUMN($U$4:$AZ$16)))-12))

This gives same results as your sample.