This formula should to the job, according to my grasp of the problem. If I misunderstood, please comment.
=ARRAYFORMULA(IF(ISBLANK(F7:F),IF(ISBLANK(G7:G),"",ROUND(($H7:H-$G7:G)*10000,2)),ROUND(($F7:F-$H7:H)*10000,2)))