ok, it's better now

i replaced IF(I15="NA";
0;I15) with IF(I15="NA";
D$1;I15)on all positions and works for all except E15, but i think this is the key condition to make it work.
you have to find a replacement for the red values to make it work for all range of conditions