Km to miles and miles to km converter

In this Excel tutorial lesson, you will learn how to convert km to miles and miles to km using the Microsoft Excel application.

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.

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.

=CONVERT(cell,”unit1″,”unit2″)

Convert using VBA code

Implement a VBA function for converting kilometers to miles with the code snippet:

Function ConvertKilometersToMiles(kilometers As Double) As Double
ConvertKilometersToMiles = kilometers * 0.621371
End Function
Sub ConvertKilometersToMilesMain()
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"
Else
MsgBox "Invalid input! Please enter
a valid number.", vbExclamation, "Error"
End If
End Sub

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.

See also  How to Bold the Highest Value in Excel

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. To convert km to miles and feet, utilize an Excel formula like:

=TRUNC(A1/1.609)&”‘ “&ROUND(MOD(A1/1.609*5280,5280),0)&””””

It will convert 10 km to 6’ 2136″.