cengleman82
MIS
I'm trying to figure out a formula that will assist with a fleet gas report. The report displays data as follows:
Vehicle #|Date of Fillup|Amt of Fuel|Odometer at fillup|Difference|MPG
1 |12/31/12| 10.00 | 30,000 | __ | 50
1 | 1/1/13 | 10.00 | 30,500 | 500 | 50
1 | 1/15/13 | 10.00 | 40,000 | 500 | 50
1 | 1/30/13 | 10.00 | 40,500 | 500 | 50
1 | 2/4/13 | 10.00 | 50,000 | 500 | 50
So, I'm trying to compute the difference field, where it takes the current odometer reading and subtracts the previous value to see how many miles the car has traveled since the last filling. I've tried using the previous function, which works ok, except for the very first value. The reason the first value messes up is because I also need to restrain the record data between 2 date parameters. Therefore, in the above example, if I set the date to be between 1/1/13 and 1/31/13, there would be no previous odometer reading for the record on 1/1/13 to reference.
Any ideas?
Vehicle #|Date of Fillup|Amt of Fuel|Odometer at fillup|Difference|MPG
1 |12/31/12| 10.00 | 30,000 | __ | 50
1 | 1/1/13 | 10.00 | 30,500 | 500 | 50
1 | 1/15/13 | 10.00 | 40,000 | 500 | 50
1 | 1/30/13 | 10.00 | 40,500 | 500 | 50
1 | 2/4/13 | 10.00 | 50,000 | 500 | 50
So, I'm trying to compute the difference field, where it takes the current odometer reading and subtracts the previous value to see how many miles the car has traveled since the last filling. I've tried using the previous function, which works ok, except for the very first value. The reason the first value messes up is because I also need to restrain the record data between 2 date parameters. Therefore, in the above example, if I set the date to be between 1/1/13 and 1/31/13, there would be no previous odometer reading for the record on 1/1/13 to reference.
Any ideas?