In this Excel tutorial lesson, you will learn how to convert km to miles and miles to km using the Microsoft Excel application.
Method 1. Convert using simple multiplication or division
1.609 is the crucial number here. To convert km to miles, you need to just divide by 1.609. Similarly, to convert miles to km, you need to multiply by 1.609.
Method 2. Conversion using CONVERT Excel function
The CONVERT function automatically converts the value based on the specified input and output units, which eliminates the need for a separate conversion factor or formula. This method is more efficient and less prone to errors, as the conversion is handled by the built-in function in Excel.
Method 3. Convert using VBA code
This VBA code will ask you how many km you want to convert to miles:
Function ConvertKilometersToMiles(kilometers As Double) As Double
ConvertKilometersToMiles = kilometers * 0.621371
Dim kilometers As Double
Dim miles As Double
kilometers = InputBox("Enter the number of
kilometers to convert to miles:")
If IsNumeric(kilometers) Then
miles = ConvertKilometersToMiles(kilometers)
MsgBox kilometers & " kilometers is equal to
" & miles & " miles", vbInformation, "Kilometers to Miles Conversion"
MsgBox "Invalid input! Please enter
a valid number.", vbExclamation, "Error"
The custom functions in the Visual Basic module handle the conversion by applying the appropriate formula, which makes the conversion process easier and more efficient. This method also allows you to modify the conversion formulas if needed, by simply editing the code in the module.
Method 4. Convert km to miles and feet.
1 mile is equal to 1.609 km, making it easy to calculate. One foot is 0.0003048 km, making it more difficult to calculate. Luckily, there is an Excel formula which converts km to miles and feet.
It will convert 10 km to 6’ 2136″.