You probably need to describe what you have in a bit more detail. I've just
tried what I think you're trying to do, and it works fine.
I have 8 in H10 and I10
I have H in H11 and N in I11
I have "=COUNTIF(H11,"=H")*H10" in H12 and "=COUNTIF(I11,"=H")*I10" in I12
I have "=H12+I12" in K12
I have "=SUM(H12:I12)" in M12
I change H11 between H and N and back. H12, K12 and M12 all show what I'd
expect.
I hide row 10. The values are still computed correctly as I change H11.
What do you have that's different?