Cellwise Start free

Excel guide · 4 min read

How to calculate fuel cost and mileage in Excel

Quick answerMiles per trip is end odometer minus start: =D2-C2. Fuel cost for a trip is miles / MPG x price, so =E2/$H$3*$H$2 with your car's MPG in H3 and the fuel price in H2. Total by month or purpose with SUMIFS, and multiply work miles by the rate your employer uses for reimbursement.

Sample data

Every result on this page was calculated from this sheet by the same spreadsheet engine the Cellwise app uses.

ABCDEFGHIJKL
1DatePurposeOdometer startOdometer endMilesSettingValueFill-up dateOdometerGallons
2Oct 2, 2026Work482104826252Fuel price per gallon (enter yours)3.29Sep 28, 20264810510.8
3Oct 4, 2026Personal482624830139Car MPG (enter yours)31Oct 12, 20264846611.6
4Oct 9, 2026Work4830148447146Rate per work mile (your employer's)0.5Oct 29, 2026487409.1
5Oct 15, 2026Work484474849346
6Oct 18, 2026Personal4849348608115
7Oct 27, 2026Work486354871277
8Nov 3, 2026Work487124878068
9Nov 6, 2026Personal487804882141

Download this sheet as an Excel practice file (.xlsx)

Step 1: A trip log from odometer readings

You drive for work a few times a week and need to claim the miles, or you just want to know what the car really costs. Log each trip with the date, Work or Personal, and the odometer at the start and the end. Miles is =D2-C2.

Odometer readings beat guessing distances from a map. They catch detours and the drive to lunch, and they let you spot gaps. If a trip's start reading doesn't match the end of the one before, some miles went unlogged.

In Excel 365, =D2:D9-C2:C9 fills the whole Miles column at once: 52, 39, 146, 46, 115, 77, 68 and 41, which totals 584.

=IF(C7<>D6,"Gap of "&C7-D6&" miles","")

Result: Gap of 27 miles

Gap of 27 miles: the trip on Oct 27 starts 27 miles after the Oct 18 trip ended.

Step 2: Fuel cost per trip and cost per mile

Keep the fuel price and your car's MPG in their own cells (H2 and H3) and point every formula at them with $. When the price changes, you change one cell.

Gallons used is miles / MPG, and cost is gallons x price. The 146-mile trip at 31 MPG and 3.29 per gallon uses about 4.7 gallons and costs 15.49. Wrap it in ROUND(...,2) if the result goes on a claim form.

Cost per mile is just price / MPG: =$H$2/$H$3 gives about 0.106, so roughly 11 cents of fuel per mile. That covers fuel only, not wear, tires or insurance.

=ROUND(E4/$H$3*$H$2,2)

Result: 15.49

15.49: fuel for the 146-mile trip at 31 MPG and 3.29 per gallon.

Step 3: Totals by month and by purpose

SUMIFS adds the Miles column with conditions. A month is "on or after the 1st and before the 1st of the next month". That pattern catches every date in October, whatever day it ends on. October has 475 miles, 321 of them for work.

Work miles for the whole log are =SUMIF(B2:B9,"Work",E2:E9): 389, or 66.6% of all driving. Multiply by the rate in H4 for the amount to claim: 389 x 0.50 = 194.50. The 0.50 is only a placeholder; use the rate your employer or reimbursement policy sets.

For October's fuel cost, divide the month's miles by MPG and multiply by the price: about 50.41.

=SUMIFS(E2:E9,A2:A9,">="&DATE(2026,10,1),A2:A9,"<"&DATE(2026,11,1),B2:B9,"Work")

Result: 321

321 work miles in October 2026.

Step 4: Your real MPG from fill-ups

The MPG on the sticker or the dashboard is a guess. Your real number comes from fill-ups. Fill the tank to full each time, note the odometer and the gallons, and divide the miles since the last fill-up by the gallons you just put in.

The gallons go with the second fill-up, not the first. That's the fuel that refilled what you burned since the last stop. Using the wrong row, =(K3-K2)/L2, gives 33.4 MPG instead of 31.1.

One tank can be off if the pump clicked early. Average over several tanks with =(K4-K2)/SUM(L3:L4): 30.7 MPG across the last two. Put that number in H3 and the trip costs get more accurate.

=ROUND((K3-K2)/L3,1)

Result: 31.1

31.1 MPG: 361 miles since the Sep 28 fill-up, divided by the 11.6 gallons it took to refill on Oct 12.

Kilometres and litres instead

Outside the US, fuel economy is usually litres per 100 km, where lower is better. With an odometer in km and litres at the pump, it's =100*litres/km. The fuel cost formula becomes km x L/100km / 100 x price per litre.

To convert, 235.215 divided by US MPG gives L/100 km. 31 MPG is about 7.6 L/100 km, and converting the Oct 12 fill-up from gallons and miles to litres and kilometres gives the same 7.6. The 235.215 figure is for US gallons; UK MPG uses a larger gallon, so use 282.481 there.

=ROUND(235.215/H3,1)

Result: 7.6

7.6: 31 US MPG is about 7.6 litres per 100 km.

Common mistakes

Dividing by the gallons from the earlier fill-up

MPG uses the miles since the last fill-up and the gallons at this fill-up. =(K3-K2)/L3, not /L2.

Typing the price into every formula

=E2/31*3.29 has to be edited row by row when prices change. Use input cells and $H$2, $H$3.

Months that miss the last day

"<="&DATE(2026,10,30) skips Oct 31. Use ">="&first day and "<"&first day of next month.

Odometer readings typed as text

Readings pasted from an app may be text and give #VALUE! or 0. Check with ISNUMBER and convert with Data > Text to Columns > Finish.

FAQ

How do I calculate gas cost for a road trip in Excel?

Enter the distance, your MPG and the price per gallon, then =distance/MPG*price. 400 miles at 31 MPG and 3.29 a gallon is about 42.45. Add a cell for passengers and divide to split it.

How do I calculate miles per gallon in Excel?

Fill the tank, note the odometer, and next time divide the miles driven since by the gallons it takes to refill: =(this odometer - last odometer)/gallons. Average several tanks for a steadier number.

What mileage rate should I use for reimbursement?

Use whatever rate your employer or the relevant authority sets; it changes over time and differs by country. Keep it in an input cell so the whole sheet updates when it changes.

How do I total miles per month?

Use SUMIFS on the Miles column with a date window: =SUMIFS(E:E,A:A,">="&DATE(2026,10,1),A:A,"<"&DATE(2026,11,1)). Add B:B,"Work" for work miles only, or use a PivotTable grouped by month.

Functions used

Related guides

Updated