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

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
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,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

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