← All how-to recipes

How to convert between units (miles, km, kg, °F…)

✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)

Convert measurements — distance, weight, temperature, volume — without hardcoding factors.

The formula

AppFormulaNotes
Excel (desktop)=CONVERT(A2,"mi","km")Unit codes are case-sensitive: "mi", "km", "kg", "lbm", "F", "C", "gal", "l"...
Google Sheets=CONVERT(A2,"mi","km")Identical.
LibreOffice Calc=CONVERT(A2,"mi","km")Identical. (Older LibreOffice also had CONVERT_OOO with different codes — avoid it.)

How it works

CONVERT knows the standard factors: 10 miles is exactly 16.09344 km. The unit strings are case-sensitive ("MI" fails with #N/A) and metric prefixes compose — "g" to "kg", "m" to "cm". Temperature works too (=CONVERT(98.6,"F","C") → 37) and handles the offset correctly, unlike a naive multiply. If you get #N/A, the two units are from incompatible categories — you can't convert kg to km.

Verified, not just documented

We ran =CONVERT(A2,"mi","km") in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 16.09344 — exactly the expected result. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned 16.09344 for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.

Functions used

CONVERT — see full Excel, Google Sheets & LibreOffice compatibility for each.