Excel by Microsoft is, without question, one of the most powerful computer programs available. We can perform an almost infinite computation on any dataset using the features and tools that Excel provides. In this article, we will explore a straightforward method anyone can use in Excel to convert latitude and longitude to UTM. You will be able to convert Lat and Long to UTM Easting, Northing, and Zone. Hence, you must follow these easy steps to Convert Lat Long to UTM in Excel.
What Is UTM?
The Universal Transverse Mercator (UTM) is a way to project maps and give coordinates to places on Earth’s surface. Like the old way of using latitude and longitude, this is a horizontal way to show where you are. The UTM system divides the Earth into 60 zones, each covering 6° longitude. A grid zone comprises both a location and a band of latitude. Sometimes, only N or S is added after the zone number to show the North or South hemisphere.
Convert Lat Long to UTM in Excel: Step-by-step Procedures
Here, we consider some latitude (Lat) and longitude (Long) values. We will find the UTM Easting, UTM Northing, and UTM Zone from these Lat & Long values. To achieve this, we must develop some Excel VBA user-defined functions.
Step 1: Implement Excel VBA Functions to Find UTM
1.1 User-defined Function for UTM Easting
We will create a function named CalculateUTMEasting. This function will take latitude and longitude values and return UTM Easting.
First, navigate to Developer >> click on Visual Basic.
Later, choose Insert >> click on Module >> paste the following code >> Save.
Function CalculateUTMEasting(latitude As Double, longitude As Double) As Double
   Dim utmZone As Integer
   utmZone = Int((longitude + 180) / 6) + 1
   Dim CentralMeridian As Double
   CentralMeridian = (utmZone - 1) * 6 - 180 + 3
   Dim ScaleFactor As Double
   ScaleFactor = 0.9996
   Dim EquatorialRadius As Double
   EquatorialRadius = 6378137#
   Dim EccentricitySquared As Double
   EccentricitySquared = 0.00669438
   Dim N As Double
   N = EquatorialRadius / Sqr(1 - EccentricitySquared * Sin(latitude * 3.14159265358979 / 180) ^ 2)
   Dim T As Double
   T = Tan(latitude * 3.14159265358979 / 180) ^ 2
   Dim C As Double
   C = EccentricitySquared * Cos(latitude * 3.14159265358979 / 180) ^ 2
   Dim A As Double
   A = Cos(latitude * 3.14159265358979 / 180) * (longitude - CentralMeridian) * 3.14159265358979 / 180
   Dim M As Double
   M = EquatorialRadius * ((1 - EccentricitySquared / 4 - 3 * EccentricitySquared ^ 2 / 64 - 5 * EccentricitySquared ^ 3 / 256) * latitude * 3.14159265358979 / 180 - (3 * EccentricitySquared / 8 + 3 * EccentricitySquared ^ 2 / 32 + 45 * EccentricitySquared ^ 3 / 1024) * Sin(2 * latitude * 3.14159265358979 / 180) + (15 * EccentricitySquared ^ 2 / 256 + 45 * EccentricitySquared ^ 3 / 1024) * Sin(4 * latitude * 3.14159265358979 / 180) - (35 * EccentricitySquared ^ 3 / 3072) * Sin(6 * latitude * 3.14159265358979 / 180))
   Dim UTMEasting As Double
   UTMEasting = ScaleFactor * N * (A + (1 - T + C) * A ^ 3 / 6 + (5 - 18 * T + T ^ 2 + 72 * C - 58 * EccentricitySquared) * A ^ 5 / 120) + 500000
   CalculateUTMEasting = Format(UTMEasting, "0.00")
End Function
1.2 User-defined Function for UTM Northing
Here, we will develop another function to calculate UTM Northing. Likewise, the CalculateUTMNorthing function takes Lat and Long and returns UTM Northing.
Likewise, Open VBA Editor >> choose Insert >> click on Module >> paste the following code >> Save.
Function CalculateUTMNorthing(latitude As Double, longitude As Double) As Double
  Â
   Dim utmZone As Integer
   utmZone = Int((longitude + 180) / 6) + 1
  Â
   Dim hemisphere As Integer
   If latitude < 0 Then
       hemisphere = -1
   Else
       hemisphere = 1
   End If
   Dim CentralMeridian As Double
   CentralMeridian = (utmZone - 1) * 6 - 180 + 3
   Dim ScaleFactor As Double
   ScaleFactor = 0.9996
   Dim EquatorialRadius As Double
   EquatorialRadius = 6378137#
   Dim EccentricitySquared As Double
   EccentricitySquared = 0.00669438
   Dim N As Double
   N = EquatorialRadius / Sqr(1 - EccentricitySquared * Sin(latitude * 3.14159265358979 / 180) ^ 2)
   Dim T As Double
   T = Tan(latitude * 3.14159265358979 / 180) ^ 2
   Dim C As Double
   C = EccentricitySquared * Cos(latitude * 3.14159265358979 / 180) ^ 2
   Dim A As Double
   A = Cos(latitude * 3.14159265358979 / 180) * (longitude - CentralMeridian) * 3.14159265358979 / 180
   Dim M As Double
   M = EquatorialRadius * ((1 - EccentricitySquared / 4 - 3 * EccentricitySquared ^ 2 / 64 - 5 * EccentricitySquared ^ 3 / 256) * latitude * 3.14159265358979 / 180 - (3 * EccentricitySquared / 8 + 3 * EccentricitySquared ^ 2 / 32 + 45 * EccentricitySquared ^ 3 / 1024) * Sin(2 * latitude * 3.14159265358979 / 180) + (15 * EccentricitySquared ^ 2 / 256 + 45 * EccentricitySquared ^ 3 / 1024) * Sin(4 * latitude * 3.14159265358979 / 180) - (35 * EccentricitySquared ^ 3 / 3072) * Sin(6 * latitude * 3.14159265358979 / 180))
   Dim UTMScaleFactor As Double
   UTMScaleFactor = 0.9996
  Â
   Dim UTMFalseNorthing As Double
   If hemisphere = 1 Then
       UTMFalseNorthing = 0
   Else
       UTMFalseNorthing = 10000000
   End If
  Â
   Dim UTMNorthing As Double
   UTMNorthing = UTMScaleFactor * (M + N * Tan(latitude * 3.14159265358979 / 180) * (A ^ 2 / 2 + (5 - T + 9 * C + 4 * C ^ 2) * A ^ 4 / 24 + (61 - 58 * T + T ^ 2 + 600 * C - 330 * EccentricitySquared) * A ^ 6 / 720)) + UTMFalseNorthing
   CalculateUTMNorthing = Format(UTMNorthing, "0.00")
End Function
1.3 User-defined Function for UTM Zone
In this context, we will implement a function named CalculateUTMZone. We must create another function to find the Latitude Band. However, the function will be called within CalculateUTMZone.
Likewise, Open VBA Editor >> choose Insert >> click on Module >> paste the below code >> Save.
Function CalculateUTMZone(latitude As Double, longitude As Double) As String
   Dim utmZone As Integer
   Dim LatitudeBand As String
  Â
   utmZone = Int((longitude + 180) / 6) + 1
  Â
   LatitudeBand = GetLatitudeBand(latitude)
   CalculateUTMZone = utmZone & LatitudeBand
End Function
Function GetLatitudeBand(latitude As Double) As String
   Dim LatitudeBand As String
  Â
   If latitude >= 0 Then
       Select Case latitude
           Case 0 To 8: LatitudeBand = "N"
           Case 8 To 16: LatitudeBand = "P"
           Case 16 To 24: LatitudeBand = "Q"
           Case 24 To 32: LatitudeBand = "R"
           Case 32 To 40: LatitudeBand = "S"
           Case 40 To 48: LatitudeBand = "T"
           Case 48 To 56: LatitudeBand = "U"
           Case 56 To 64: LatitudeBand = "V"
           Case 64 To 72: LatitudeBand = "W"
           Case Else: LatitudeBand = "X"
       End Select
   Else
       Select Case -latitude
           Case 0 To 8: LatitudeBand = "M"
           Case 8 To 16: LatitudeBand = "L"
           Case 16 To 24: LatitudeBand = "K"
           Case 24 To 32: LatitudeBand = "J"
           Case 32 To 40: LatitudeBand = "H"
           Case 40 To 48: LatitudeBand = "G"
           Case 48 To 56: LatitudeBand = "F"
           Case 56 To 64: LatitudeBand = "E"
           Case 64 To 72: LatitudeBand = "D"
           Case Else: LatitudeBand = "C"
       End Select
   End If
  Â
   GetLatitudeBand = LatitudeBand
  Â
End Function
Step 2: Convert Lat Long to UTM Easting
First, choose cell D5 >> insert the following formula >> drag the Fill Handle icon to D13.
=CalculateUTMEasting(B6,C6)
Step 3: Convert Lat Long to UTM Northing
First, select cell E5 >> insert the following formula >> drag the Fill Handle icon to E13.
=CalculateUTMNorthing(B6,C6)
Step 4: Convert Lat Long to UTM Zone
To begin, select cell F5 >> insert the below formula >> drag the Fill Handle icon to F13.
=CalculateUTMZone(B6,C6)
Convert Lat Long to UTM Zone in Excel: 2 Simple Methods
For illustration, the following data set has both latitude and longitude values. Using Google Earth, we get these values from some states in America and Africa. We’ll convert latitude and longitude to UTM in Excel using these two methods.
1. Combine IF, CONCATENATE, and INT Functions to Convert Lat Long to UTM in Excel
Here are the IF, CONCATENATE, and INT functions that we’ll apply in this method. The IF function lets you compare a value with what you expect logically. The CONCATENATE function enables us to merge the contents of many cells into one. Excel’s INT function retrieves the integer component of a decimal value by rounding it down. We can use these three functions to Convert Lat Long to UTM in Excel. Therefore, follow the steps below to perform the task.
STEPS:
- Firstly, I start by entering the following Excel formula into the cell D5 >>Â hit Enter.
Now, use the formula used in the D5 cell to get the UTM of the other Lat and Long values. To achieve this, click on the Fill Handle icon.
- Subsequently, hold it down as well as drag it to cell D10.
- As a result, it will return the desired output, as shown below.
🔎 How Does the Formula Work?
For this formula to make sense, you need to know how to use the following Excel functions:
INT, IF, and CONCATENATE
Now, observe these formulas.
- INT(31+C5/6)
The mathematical expression gives the values – {13.36236052;11.56792704;11.18443451;14.66315629;11.98617117;34.99888883}
Then, by involving the INT function we get – {13;11;11;14;11;34}
- CONCATENATE(INT(31+C5/6),” N”) or CONCATENATE(INT(31+C5/6),” S”)
CONCATENATE(INT(31+C5/6),” N”) joins the output value of INT(31+C5/6) with N. And CONCATENATE(INT(31+C5/6),” S”) merges the output value of INT(31+C5/6) with S. Here, CONCATENATE function concatenates N for true and S for false.
- IF(B5>=0,CONCATENATE(INT(31+C5/6),” N”),CONCATENATE(INT(31+C5/6),” S”))
Lastly, the IF function evaluates cells B5 to B10 of our specified dataset – {True;True;True;True;True;False}
Therefore, we get – {13 N;11 N;11 N;14 N;11 N;34 S}
2. Transform Lat Long to UTM Through Excel VBA
Microsoft has created the Visual Basic for Application (VBA) programming language. VBA is used to execute various operations, and different user types operate the programming language for multiple purposes. Here we will Convert Lat Long to UTM using some functions of the VBA language. Hence, study the procedure detailed below.
STEPS:
- First, choose the active sheet >> Secondly, go to Developer >> Then, click on Visual Basic.
- Next, select Insert and later click Module.
- After that, put the following code in the Module box.
Sub SOFTEKOlatLongToUtm()
Dim i As Integer
Dim lat As Double
Dim lng As Double
Dim UTM
Dim UTMint
For i = 5 To 10
lat = Cells(i, 2).Value
lng = Cells(i, 3).Value
UTM = 31 + lng / 6
UTMint = CInt(UTM)
If lat >= 0 Then
UTMint = UTMint & " N"
Else
UTMint = UTMint & " S"
End If
Cells(i, 4).Value = UTMint
Next
End Sub
- Lastly, press F5 or click the Run button.
- Thus, this is where the output will be directed.
Download Practice Workbook
You are welcome to get a free copy of the example workbook just below, and we used that all during the session.
Conclusion
From now on, you can convert Lat Long to UTM in Excel using the steps we just discussed. Keep using those, and let us know if you have any other ways to get the work done or if you have any new ideas. Remember to post questions, comments, or suggestions in the section below.
<< Go Back to Geocoding in Excel | Learn Excel
Get FREE Advanced Excel Exercises with Solutions!
Thank you but this doesn’t convert lat long to utm. Just telling which zone it is.
Dear Amir
Sorry for the late reply. Thanks a lot for bringing the issue to us. I have developed some user-defined functions using Excel VBA. These functions take Lat and Long values and return UTM Easting, Northing and Zone. I also have modified the article accordingly. So, I recommend you to go through the article again. You will not be disappointed, I promise.
Regards
Lutfor Rahman Shimanto
Hello, AMIR!
Thanks for your comment.
Yes! The code you provided is a simple implementation for converting latitude and longitude to UTM in Excel VBA. However, it is not the most accurate way to convert coordinates, as it uses a simplified formula for converting latitude and longitude to UTM coordinates.
The formula used in this code only accounts for the UTM zone and hemisphere based on the latitude and longitude values. It does not take into account the curvature of the Earth’s surface, which can lead to inaccuracies in the UTM coordinates. If you need this, then you can use the following code:
To use this code, open a new Excel workbook, press ALT+F11 to open the VBA editor, and insert a new module. Copy and paste the code into the module, and save the module.
Then, in your Excel sheet, you can use the formula =LatLonToUTM(lat, lon) where lat and lon are the latitude and longitude coordinates you want to convert to UTM format.
This code uses the Proj4 library to perform the coordinate transformation. You may need to install this library on your computer if it is not already installed.
And if you don’t want to use this library. you can use the following code instead.
This code converts latitude and longitude coordinates to UTM coordinates and returns the result as a string in the format "Zone Letter X Y". You can call this function by passing the latitude and longitude values as parameters, like this:
Make sure you have the LatLongToUTM function defined in your VBA code module before running the ConvertLatLongToUTM sub.
Hope this will help you.
Good Luck!
Regards,
Sabrina Ayon
Author, ExcelDemy.
Nothing on Eastings and Northing, its all about zoning only.
Hello MOSES
Thanks for reaching out and posting your comment. You are absolutely right. However, I am delighted to inform you that I have modified the article. After going through the article, you must be able to convert Lat Long to UTM Easting, Northing and Zone. I have developed some user-defined functions using Excel VBA to achieve the goal.
Regards
Lutfor Rahman Shimanto
Hi
This article has been extremely helpful, The codes above worked for Easting and Zone but not the Northing UTM…. I can’t seem to find a fix that works at the moment, even with your numbers it wouldn’t work. Any tips?
Dear Faisal
Thanks a ton. Your appreciations mean a lot to us. I am glad you have found the article very helpful.
You mentioned the user-defined functions only work for UTM Zone and UTM Easting on your end. The user-defined function for calculating UTM Northing is not working.
However, the issue you are addressing is unclear to us. On our end, it is working perfectly. I am using Microsoft 365. However, It should not make any difference. The code should work for all versions of Excel.
Please share your workbook containing a dataset with us. You can also post your query and attach the dataset in ExcelDemy Forum. We need more information about your problem, such as if it returns any error or wrong values.
The functions often may return values using scientific notation like 2.34344E+13. To avoid this type of notation, you may use an Event procedure.
Excel VBA Event Procedure:
I am looking forward to receiving your reply. Stay blessed and Good luck.
Regards
Lutfor Rahman Shimanto
hi ,sir
you table northing cannot use ,it doesnot working ,would you please update it again ,we use the office 2016 or 2019,thanks .
Hello XU
Thanks for reaching out. All the User-Defined functions mentioned in this article calculate UTM Easting, UTM Northing and UTM Zone accurately.
I am comparing the result with an Online UTM Calculator website (LatLong.net) like the image below for demonstration.
If you still have doubts, you can share your dataset in our ExcelDemy Forum. Good luck!
Regards
Lutfor Rahman Shimanto
hi sir ,would u please write UTM convert to Lat long we want to this ,thanks so much.
Hello XU
Thanks for thanking me. Your appreciation means a lot to us. You wanted to convert UTM (UTM Easting, UTM Northing and UTM Zone) to Latitude and Longitude values.
I am presenting some Excel VBA User-Defined functions, and these functions will achieve your goal.
Follow these Steps:
Step 1: Open the VBA Editor window => Paste the following code in a module => Save.
Step 2: Return to the sheet => Choose cell E4 => Insert the following formula => And drag the Fill Handle icon to cell E11.
Step 3: Choose cell F4 => Insert the following formula => And drag the Fill Handle icon to cell F11.
Things to Keep in Mind:
As we cannot use all decimal points for some values (UTM Northing), we may not get the same value (Latitude) like previous one.
Hopefully, the idea will help you. Good luck.
Regards
Lutfor Rahman Shimanto
The CalculateUTMNorthing function is simply giving a #VALUE! error on Excel. Not really sure how to debug this because it is very generic
Hello CHRISTOF
Thanks for sharing your queries. Depending on your OS Version, the User-defined functions may give this type of error. Ensure you run a 64-bit Windows, and let us know if you still face the error.
Regards
Lutfor Rahman Shimanto
ExcelDemy
Hello, thank you for the codes. Extremely helpful. However, when I entered the codes and then calculate the Northing, I got “#value” as an output. Wonder if you can help.
Hello! DIANA. Thanks for sharing your queries. Depending on your OS version, the user-defined functions may cause this error. Ensure you run 64-bit Windows, and let us know if you are still facing the error.
Regards
Lutfor Rahman Shimanto
ExcelDemy
Hi I have a question. I am trying to use your code and it worked for UTM Easting and UTM zone but I am getting a “#VALUE!” error for northing. Please contact me and I can send you my dataset if you are able to help. Thank you.
Hello ALAN
Thank you for reaching out. Please ensure that you’re using a 64-bit Windows system. Let us know if the issue persists.
You can share your dataset by creating a Conversation with my forum account in the ExcelDemy Forum.
Best regards
Lutfor Rahman Shimanto
ExcelDemy