Fuel Mileage Calculation

guamlenahans

Board Regular
Joined
Oct 25, 2006
Messages
113
Hi,
I have a table where i track fuel purchased for 7 vehicles. Vehicles are tracked by plate number. My columns are: Date, Vehicle, Gallons, Cost, Total Cost, and odometer. We enter them row after row and I pivot out the gallons for each vehicle. I'm trying to add two columns where I will factor in the miles driven and the miles per gallon. I will need the formula to look back at the last entry for the vehicle and calculate the miles driven between then and the latest fill up based on the odometer readings. I cant figure out how to do that.

Ideas?

Thanks

Rob
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
I think this is the working example @jasonb75 is describing
MrExcel_20200331.xlsx
ABCDEFGHI
1DateVehicleGallonscOSTTotal CostOdometerMiles drivenMileage
21-Jul249JAN15.8343685  
33-Jul730DQZ15.2620411  
43-Jul818BAV29.23876928  
51-Jul398UHD26.13923543  
68-Jul368YOO15.30329285  
717-Jul398UHD27.017236841415.218936
818-Jul749FHT26.42437015  
924-Jul818BAV28.29770901625.726405
1025-Jul730DQZ14.3032058417312.09536
1125-Jul398UHD25.2532384330011.87978
126-Aug818BAV29.1237728836012.36136
138-Aug398UHD25.7012396542216.41959
1413-Aug749FHT18.773724022511.98721
1514-Aug478A7612.847169980  
1619-Aug730DQZ16.1422082941825.89518
Sheet7
Cell Formulas
RangeFormula
H2:H16H2=IFERROR(F2-VLOOKUP(B2,B$1:F1,5,0),"")
I2:I16I2=IF(H2="","",H2/C2)
 
Upvote 0
Like in the screen shot above, Cell 13. 398UHD/422 miles, but the difference in entries between that and
the last fill up (row 11) is 122 miles
 
Upvote 0
The formula wasn't working originally because you had some extra $ symbols that were stopping it from dragging down correctly.

There is a major flaw with my suggestion though (I blame lack of sleep), I think that the suggestion in post #9 should return more accurate results than mine.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top