A fuel cost calculator in Excel works from one core formula: cost = (distance ÷ MPG) × price per gallon, or for metric, cost = (distance ÷ 100 × L/100km) × price per litre. Put distance, efficiency and fuel price in three cells, then multiply distance by efficiency and price in a fourth. That single formula gives you a reusable calculator you can copy down for any trip, and you can extend it with a round-trip column, a cost-per-mile column and a running total. This guide builds the calculator from scratch, explains each formula, and covers the mistakes that make the numbers wrong.

What You'll Need

  • Excel (any recent version, desktop or Microsoft 365 web app) or a compatible spreadsheet app such as Google Sheets or LibreOffice Calc. The formulas below work in all three.
  • Your vehicle's fuel efficiency figure: miles per gallon (MPG) in the US, or litres per 100 km (L/100km) in metric countries. Check the owner's manual or the maker's spec sheet rather than guessing.
  • The current price of fuel at the pump, per gallon or per litre.
  • The distance of the trip, in miles or kilometres, matching the unit system you use for efficiency.

Step-by-Step

  1. Set up your input cells. Open a blank sheet. In cell A1 type Distance, A2 Efficiency, A3 Fuel Price. In B1 enter the trip distance (for example 240), in B2 the MPG (for example 28), and in B3 the price per gallon (for example 3.50). Keeping inputs in their own cells means you change one number and every formula updates.
  2. Label the output. In A4 type Fuel Cost. Leave B4 for the formula.
  3. Enter the core formula. Click B4 and type = (B1 / B2) * B3 then press Enter. This divides distance by efficiency to get gallons used, then multiplies by price. With the example numbers it returns about 30.00. If you are working in metric, the formula is = (B1 / 100 * B2) * B3 where B2 holds L/100km and B3 the price per litre.
  4. Format the result as currency. Select B4, then use the number format dropdown on the Home tab to choose Currency, or press Ctrl+1 (Cmd+1 on Mac) and pick Currency. The value stays a number; only the display changes.
  5. Add a round-trip column. In C1 type Round Trip and in C4 type = B4 * 2. This doubles the one-way cost. If you would rather store the round-trip distance as an input, change B1 to the full distance instead and skip this column.
  6. Add cost per mile (or per km). In D1 type Cost per Mile and in D4 type = B4 / B1. This tells you what each mile of the trip costs in fuel, which is useful for comparing routes or vehicles.
  7. Build a table for multiple trips. In row 6, put headers: Trip, Distance, Efficiency, Price, Cost. Fill in a few trips below. In the Cost cell of the first data row (say E7) type = (B7 / C7) * D7, then drag the fill handle down. Each row now calculates independently.
  8. Add a running total. Below the table, type Total Fuel Cost and use = SUM(E7:E20) adjusted to your range. This adds every trip's cost.
  9. Lock the fuel price if it is the same for all trips. If every row uses the same price, put the price in one cell (say B3) and reference it with an absolute reference: = (B7 / C7) * $B$3. The dollar signs stop the reference shifting when you copy the formula down.
  10. Check your units match. Distance in miles must pair with MPG and price per gallon; distance in kilometres must pair with L/100km and price per litre. Mixing them is the most common reason a calculator returns a nonsense number.

Common Mistakes

  • Mixing unit systems. Miles with litres, or kilometres with gallons, produce a figure that looks plausible but is wrong. Decide on one system before you type anything.
  • Using the wrong efficiency figure. The MPG on the window sticker is an official test-cycle number; real-world economy is usually lower, especially on short trips or in cold weather. Use a figure from your own fill-ups if you want accuracy.
  • Forgetting the round trip. A one-way distance entered as the trip length halves the real cost. Multiply by two or enter the full distance.
  • Relative references that shift. Copying a formula down without the $ anchors moves the price reference to an empty cell, giving zero or an error.
  • Text instead of numbers. A price typed with a currency symbol in a cell formatted as text will not calculate. Enter plain numbers and format the cell as currency instead.
  • Dividing the wrong way round. Cost is distance divided by efficiency, not multiplied. Multiplying gives a huge, obviously wrong figure.

Tips

  • Name your input cells (select the cell, type a name in the Name Box) so formulas read like = (Distance / Efficiency) * Price instead of cell addresses.
  • Add a data validation rule to the efficiency cell so only positive numbers can be entered; a zero there causes a divide-by-zero error.
  • Keep a separate small table of your own recorded fill-up data to derive a realistic efficiency figure rather than relying on the official one.
  • Use a second sheet for the input assumptions and link to it, so the calculator sheet stays clean and shareable.
  • If you track many trips, add a date column and use SUMIFS to total costs by month.

Troubleshooting

If the result shows #DIV/0!, the efficiency cell is empty or zero. Fill it in. If you see #VALUE!, one of the referenced cells contains text rather than a number; retype it as a plain figure. If the answer is far too high or too low, check the unit pairing first, then confirm you divided rather than multiplied. If copying the formula down gives zeros, the price reference shifted to an empty cell; add the dollar signs. If the cell shows the formula text instead of a result, the cell is formatted as Text; change the format to General and re-enter the formula. If a currency symbol appears inside the formula bar, the number was typed as text and needs re-entering.

Frequently Asked Questions

What is the formula for fuel cost in Excel?

Cost = (distance ÷ efficiency) × price. In US units that is (miles ÷ MPG) × price per gallon; in metric it is (km ÷ 100 × L/100km) × price per litre.

Can I use this for a round trip?

Yes. Either double the one-way distance in the input cell or multiply the result by two in a separate column.

Why does my calculator show an error?

Almost always an empty or zero efficiency cell, or a number stored as text. Check both before changing the formula.

Does it work in Google Sheets?

Yes. The same formulas and cell references work, and absolute references use the same dollar-sign syntax.

How do I calculate cost per mile?

Divide the trip cost by the distance: = B4 / B1. That gives the fuel cost of each mile travelled.