I must be missing something. Why wouldn't this work?
=IF($M1222=U$11,$H1222,0)


Filling ToRight does not change the Row reference in a formula, just as Filling Down does not change the Column reference.