How to Convert Units in Excel With the CONVERT Function
By ExcelReady TeamUpdated 6 min read
The short answer
To convert units in Excel, use =CONVERT(number, from_unit, to_unit), for example =CONVERT(10,"mi","km") returns 16.09344. The unit codes go in double quotes and are case-sensitive, so "km" works but "KM" gives #N/A. You can also multiply or divide by a conversion factor stored in a locked cell, such as 1.609344 km per mile.
Key takeaways
- CONVERT has three parts: the number, the unit it is in, and the unit you want, like =CONVERT(B2,"lbm","kg").
- Unit codes are case-sensitive and must be in quotes: "km" works, "Km" and "KM" return #N/A.
- Both units must measure the same thing. Converting miles to kilograms returns #N/A.
- Wrap CONVERT in ROUND to get a tidy result, such as =ROUND(CONVERT(B2,"km","mi"),1).
- Without CONVERT, multiply or divide by a factor in a cell locked with $ signs.
On this page+
To convert units in Excel, use the CONVERT function: =CONVERT(10,"mi","km") turns 10 miles into 16.09344 kilometres. It handles length, weight, temperature, volume, time and more, as long as you type the right unit codes. This guide lists the codes you'll use most, shows how to fix #N/A errors, and covers the backup method: multiplying by a conversion factor in a locked cell.
How the CONVERT function works#
CONVERT takes a number in one unit and returns it in another. It has three arguments (the parts inside the brackets):
=CONVERT(number, from_unit, to_unit)| Part | What it means | Example |
|---|---|---|
| number | The value to convert, or a cell that holds it | B2 |
| from_unit | The unit the number is in now, in quotes | "mi" |
| to_unit | The unit you want, in quotes | "km" |
So =CONVERT(B2,"mi","km") reads as "take B2, which is in miles, and give it to me in kilometres". CONVERT is built into Excel 2007 and later on Windows and Mac, and in Microsoft 365.
Common unit codes for CONVERT#
The unit codes are short and case-sensitive. These are the ones most people need:
| Measure | Units and codes |
|---|---|
| Length | metre "m", kilometre "km", centimetre "cm", inch "in", foot "ft", yard "yd", mile "mi" |
| Weight | gram "g", kilogram "kg", pound "lbm", ounce "ozm" |
| Temperature | Celsius "C", Fahrenheit "F", Kelvin "K" |
| Volume | litre "l", millilitre "ml", US gallon "gal", US fluid ounce "oz" |
| Time | year "yr", day "day", hour "hr", minute "mn", second "sec" |
Codes like "km" and "ml" are a metric prefix (k for kilo, m for milli, c for centi) joined to a base unit. Note the two ounces: "ozm" is weight and "oz" is fluid volume.
Here is CONVERT on everyday conversions:
| Formula | Result |
|---|---|
=CONVERT(10,"mi","km") | 16.09344 |
=CONVERT(5,"ft","m") | 1.524 |
=CONVERT(150,"lbm","kg") | 68.0388555 |
=CONVERT(68,"F","C") | 20 |
=CONVERT(2,"gal","l") | 7.570823568 |
=CONVERT(90,"mn","hr") | 1.5 |
When you type =CONVERT( and the first comma, Excel shows a list of units you can pick from, which helps you avoid typos.
Why does CONVERT return #N/A?#
CONVERT returns #N/A when it doesn't recognise a unit or can't convert between the two. Check these in order:
- Capitals.
"KM"and"Kg"fail. Use"km"and"kg". Temperature codes are capitals:"C"and"F". - Different kinds of unit.
=CONVERT(5,"ft","kg")fails, because length can't become weight. - Spelling.
"lb"and"oz"look right but aren't the weight codes. Pounds are"lbm", weight ounces"ozm". - Missing quotes.
=CONVERT(B2,mi,km)gives #NAME?, because Excel reads mi as a name.
If the number itself is text, such as "10 miles", CONVERT returns #VALUE!. Put the number in one cell and the unit in another.
How to round the converted result#
CONVERT returns every decimal place, which is too many for most reports. Wrap it in ROUND to keep the number of decimals you want:
=ROUND(CONVERT(B2,"lbm","kg"),1)If B2 holds 150, the result is 68, because 68.0388555 rounds to 68.0. The second argument of ROUND is the number of decimal places. The ROUND function guide shows the syntax, and the article on ROUND, ROUNDUP and ROUNDDOWN explains when to round up or down instead.
ROUND changes the stored value. If you only want the display tidier, use Decrease Decimal on the Home tab instead, and the full value stays in the cell.
Put the unit codes in cells and fill down#
To convert a whole column, keep the unit codes in their own cells and lock them with $. Say E1 holds km and F1 holds mi (typed without quotes in the cells). In C2:
=CONVERT(B2,$E$1,$F$1)Fill it down (Windows: Ctrl+D; Mac: ⌘D). B2 has no $, so it moves to B3, B4 and so on. $E$1 and $F$1 are absolute references: they stay fixed as you fill. To switch a whole report to other units, change E1 and F1, not every formula.
Convert units with a conversion factor instead#
You can convert units in any spreadsheet by multiplying or dividing by a conversion factor. This works when a unit isn't in CONVERT's list, or when the file must work in other tools. Some factors are exact by definition:
| Conversion | Factor | Formula (value in B2) |
|---|---|---|
| Miles to km | 1 mile = 1.609344 km | =B2*1.609344 |
| Km to miles | divide by the same factor | =B2/1.609344 |
| Pounds to kg | 1 lb = 0.45359237 kg | =B2*0.45359237 |
| Inches to cm | 1 in = 2.54 cm | =B2*2.54 |
| °F to °C | subtract 32, then × 5/9 | =(B2-32)*5/9 |
Rather than typing the factor into every formula, put it in one cell and lock it. If E2 holds 1.609344, then =ROUND(B5/$E$2,1) turns a 42.195 km marathon into 26.2 miles. The exercise on this page uses exactly that. The guides on the multiply formula and the divide formula cover the basics, and a conversion factor is really a fixed ratio, like those in how to calculate a ratio.
Temperature is the exception: you can't just multiply, because the scales start at different points. Use CONVERT or the full formula above.
Split a time conversion into whole units#
Some conversions need a whole part and a remainder, such as 135 minutes as "2 hours 15 minutes". Divide for the whole part, and use MOD for what is left:
=INT(B2/60)&" h "&MOD(B2,60)&" min"With 135 in B2, the result is 2 h 15 min. INT keeps the whole hours and MOD returns the remainder after dividing by 60. The same pattern turns inches into feet and inches, with 12 instead of 60. The guide to MOD and INT has more examples.
Practise it#
Unit conversion is simple maths, so job tests use it to check that you can write a clean formula and lock a reference. Practise your first formulas in a live spreadsheet, then practise absolute references so a factor like $E$2 stays put when you fill down. Each lesson checks your formula instantly, and the exercise on this page is a quick warm-up.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
E2 holds the number of kilometres in one mile. In C5, convert the marathon distance in B5 to miles: divide by the locked factor $E$2 and round to 1 decimal place.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Miles | Km per mile | ||||
| 2 | ||||||
| 3 | ||||||
| 4 | ||||||
| 5 | ||||||
| 6 | ||||||
| 7 | ||||||
| 8 |
Tip: Divide the kilometres by the factor, then wrap it all in ROUND with 1 as the second argument: =ROUND(B5/$E$2,1).
Practise this in a lesson
Frequently asked questions
Is there a formula to convert units in Excel?
Yes. CONVERT changes a number from one unit to another, for example =CONVERT(5,"ft","m") returns 1.524. It covers length, weight, temperature, volume, time, area, speed, energy and more.
Why does CONVERT return #N/A?
Usually a unit code is wrong. Codes are case-sensitive, so check capitals, spelling and quotes. CONVERT also returns #N/A when the two units measure different things, such as feet and kilograms.
How do I convert Fahrenheit to Celsius in Excel?
Use =CONVERT(A2,"F","C"). For 68 °F it returns 20. Without CONVERT, the formula is =(A2-32)*5/9.
What is the CONVERT code for pounds?
Use "lbm" for pounds (pound mass) and "kg" for kilograms. So =CONVERT(150,"lbm","kg") returns about 68.04. Ounces by weight are "ozm".
How do I convert minutes to hours in Excel?
Divide by 60, as in =A2/60, or use =CONVERT(A2,"mn","hr"). Both turn 90 minutes into 1.5 hours.