DId you aggregated the results before writing if condition
if sum(Actual) <= Sum(RoFo)
without aggregating you may get the wrong results.
If it helps mark this answer as correct
if it not kindly attach a workbook to decipher more and help you out
I did the aggregations...