=IF(C7=B7,(B$5-$A$5),IF(B7>C7,(B$5-$A$5),IF(C7>B7,(B$5-$A$5)*-1,"")))
need to change for the different cells
in H
=IF(G7=F7,(F$5-$B$5),IF(F7>G7,(F$5-$B$5),IF(G7>F7,(F$5-$B$5)*-1,"")))
BUT I dont make it 2 as only 1 difference between B5 and F5
On the other cells not sure what date you are comparing to
B5
or does that change each time ?
so should
=IF(K7=J7,(J$5-$B$5),IF(J7>K7,(J$5-$B$5),IF(K7>J7,(J$5-$B$5)*-1,"")))
Be checking F5
=IF(K7=J7,(J$5-$F$5),IF(J7>K7,(J$5-$F$5),IF(K7>J7,(J$5-$F$5)*-1,"")))
but you should get the idea from the above formulas and be able to change