2

I need help with an Excel formula. I am trying to create an MPG tracker for my company vehicles, and I would like the results of a formula to remain blank until all the relevant data has been entered. I have my starting mileage in cell B9, my ending mileage in cell C9, and my total miles in cell D9. I would like the total miles cell (D9) to remain blank until I have entered my ending mileage at the end of the day. The current Formula I have entered in cell D9 now is: =C9-B9. See the below screenshot.

enter image description here

2 Answers 2

4

You can try using IF, OR and ISBLANK like this:

=IF(OR(ISBLANK(B9),ISBLANK(C9)), "", C9-B9)
3
  • Bingo!! That did the trick. I really need to take an advanced excel class to get a better understanding of what all the functions actually mean. Thanks again. Feb 21, 2014 at 12:17
  • @user302068 ISBLANK() returns true or false if the cell is blank. OR will return either true or false: if all inside brackets is false, it will return false. If only one returns true, it returns true. I hope that makes things a little clearer :) IF should be easy to understand IF(expr, res1, res2) : if the expression expr is true, then calculate res1, else calculate res2.
    – Jerry
    Feb 21, 2014 at 12:20
  • Ok I figured it out, I had to delete the "DAY" and just enter the value, so =IF(OR(ISBLANK(E2)),"",E2+6) Now subsequent rows only add + 6 from column E.
    – rnmonica5
    Dec 29, 2014 at 20:59
2

You could try a conditional formula using the IF function. Microsoft has a whole article about how they work. Your solution would look like this:

=IF((C9-B9)<=0, "", C9-B9)
1
  • @CanadianLuke I corrected that piece to be <= instead of just <. The way it is now, it's faster and simpler than the other answer. Feb 26, 2015 at 18:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .