Miles per Gallon (MPG)

Excel Formulas › Automotive & Fleet

All versions

MPG — miles driven divided by gallons used — is the basic fuel-economy figure. Track it tank to tank to spot a drop that signals a maintenance issue.


Quick formula: MPG from miles and gallons:
=miles_driven / gallons_used
Miles over gallons. Reset the trip meter at a fill-up, then divide at the next.

The example

360 miles, 12 gallons.

AB
1ItemValue
2Miles360
3Gallons12 → 30 MPG

The formula

The formula:

=B2 / B3 // miles ÷ gallons

How it works

How it works:

  1. Divide miles driven on a tank by the gallons it took to refill.
  2. Use the trip odometer reset at fill-up for an accurate per-tank figure.
  3. Average across tanks with AVERAGE, or compute lifetime as total_miles / total_gallons.
  4. For L/100km (metric), the relationship is inverse — lower is better.

Lifetime MPG isn’t the average of tank MPGs. Average the ratios and a small low-mileage tank counts as much as a big one. The correct lifetime figure divides total miles by total gallons — SUM(miles) / SUM(gallons) — which weights each tank by its actual fuel use.

Try it: interactive demo

Live demo

Miles driven and gallons used.

MPG:

Variations

Lifetime MPG

Weighted right:

=SUM(miles) / SUM(gallons)

L/100km

Metric:

=liters / km * 100

Range on a tank

How far:

=MPG * tank_gallons

Pitfalls & errors

Full-to-full. Measure gallons by refilling to the same level each time.

Don’t average ratios. Use total miles ÷ total gallons for lifetime.

Zero gallons. A missing fill gives #DIV/0!.

Practice workbook

📊
Download the free Miles per Gallon (MPG) practice workbook
An MPG sheet with the lifetime, metric, and range variants, plus 4 challenges with answers. No sign-up required.

Frequently asked questions

How do I calculate MPG in Excel?
Divide miles by gallons: =miles_driven / gallons_used. 360 miles on 12 gallons is 30 MPG.
How do I get accurate lifetime MPG?
Use =SUM(miles) / SUM(gallons), which weights each tank by fuel used — not the average of tank MPGs.
How do I convert to L/100km?
Use =liters / km * 100; note lower is better in the metric measure.

Stop fighting formulas. Learn them in a day.

This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related formulas: Cost per mile · Fuel cost for a trip · EV vs gas cost per mile