Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Displaying Latitude and Longitude.

Displaying Latitude and Longitude

Written by Allen Wyatt (last updated January 22, 2022)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021


1

If you do much geographic work, you may wonder if you can use Excel to display longitude and latitude in a cell in terms of degrees, minutes, and seconds. There are three ways that a solution can be approached.

First, if you just want to affect the display, you can follow these steps:

  1. Select the cell you want to format for latitude or longitude.
  2. Press Ctrl+Shift+F or press Ctrl+1. Excel displays the Format Cells dialog box.
  3. Make sure the Number tab is selected.
  4. In the categories list, choose Custom. (See Figure 1.)
  5. Figure 1. The Number tab of the Format Cells dialog box.

  6. Place the insertion point in the Type box and erase whatever is there.
  7. Type three # signs.
  8. Hold down the Alt key and type 0176 on the numeric keypad. (The numbers must be typed on the numeric keypad. This inserts the degree symbol. If you don't have a numeric keypad, you need to enable the Num lock before using the Alt 0176 keyboard shortcut.)
  9. Type a space, two zeros, an apostrophe (the single quote), and another space.
  10. Type two more zeros followed by two more apostrophes. (A quote mark won't work; it must be two apostrophes.)
  11. Click on OK.

Now, if you type a number such as 1234543 into the cell, it is displayed as 123 degrees, 45 minutes, and 43 seconds.

Sometimes, however, you may want to take a decimal value that represents latitude and longitude and display it in degrees, minutes, and seconds. For instance, you may want 122.44 (which is a decimal representation of degrees) to be displayed as 122 degrees, 26 minutes, and 24 seconds. This cannot be accomplished with formatting the cell in which the number is contained. Instead, you must use a formula to achieve the proper display. For instance, if 122.44 is in cell A7, then you can put the following in cell B7:

=TEXT(TRUNC(A7), "0" & CHAR(176) & " ") & TEXT(INT((ABS(A7)
- INT(ABS(A7)))*60), "0' ") & TEXT(((((ABS(A7)-INT(ABS(A7)))*60)
- INT((ABS(A7) - INT(ABS(A7)))*60))*60), " 0''")

This is a long formula, but it provides the desired formatting of the latitude or longitude value. The result is text, and cannot be used in any calculations. If you want to use a display instead, you can simply divide the decimal value of the latitude or longitude by 24, which converts it into the same value ranges used by Excel to represent times. Then you can format the display of the formula as follows:

  1. Select the cell containing the formula.
  2. Press Ctrl+Shift+F. Choose Cells from the Format menu. Excel displays the Format Cells dialog box.
  3. Make sure the Number tab is selected.
  4. In the categories list, choose Custom.
  5. Place the insertion point in the Type box and erase whatever is there.
  6. Type [h] followed by a degree sign (remember; you hold down the Alt key and type 0176 on the numeric keypad).
  7. Type a space, mm, an apostrophe, another space, ss, and two more apostrophes.
  8. Click on OK.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9457) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Excel here: Displaying Latitude and Longitude.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Displaying a Hidden First Row

If you hide the first rows of a worksheet, you may have a hard time getting those rows visible again. Here's a simple way ...

Discover More

Opening a Template

If you have a template stored on disk, you can open it and make changes to it just as you do other documents. This tip ...

Discover More

Finding Text in Text Boxes

Want to search for text that may appear in a text box rather than in a regular worksheet cell? You can only perform the ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (ribbon)

Setting a Default Date Format

Enter a date into a cell, and Excel allows you to format that date in a variety of ways. Don't see the date format you ...

Discover More

Enforcing a Desired Font

If your workbooks are shared and used by a number of different people, you may end up with some formatting in those ...

Discover More

Using an Exact Number of Digits

Excel allows you to format numeric data in all sorts of ways, but specifying a number of digits independent of the ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is two more than 7?

2022-01-27 00:17:09

Tomek

I sail (on Georgian Bay) and frequently use Canadian Notices to Mariners to mark changes to the nautical charts in my GPS and chart plotter. The problem I had was the opposite of the one described by Allen. I needed to convert a position entry e.g., 44°54′56.6″N 080°09′52.3″W to decimal degrees entries for latitude and longitude. The position entry imported from NotMar is just a string of text giving both latitude and longitude. I needed two decimal numbers to upload into the two devices I use. To achieve this I created two user defined functions: LatDD(position) and LonDD(position). If you copy the code into your VBA editor, you can then align the numbering of the string characters so it is easy to see which parts of the string are extracted.
The functions depend on the position of each element, rather than using °, ', and " as delimiters. This could be done because NotMar is very consistent in formatting the position.
--------------------------------------------------

Public Function LatDD(PositionDMS As String) As Double
'Converts Position given in NotMar in DMS to Latitude in Decimal Degrees
'Requires PositionDMS to follow format like: 45°46'03.2"N 080°36'58.8"W
' in-string pos: 12345678901234567890123456

'this argument is a string of 26 characters and gives position with one decimal for seconds for both Lon and Lat
'will assume nothern latitude (+)
'A sister function is LonDD
Dim Degs As Double, Mins As Double, Secs As Double

Degs = Val(Left(PositionDMS, 2))
Mins = Val(Mid(PositionDMS, 4, 2))
Secs = Val(Mid(PositionDMS, 7, 4))

LatDD = Degs + Mins / 60 + Secs / 3600


End Function 'LatDD

Public Function LonDD(PositionDMS As String) As Double
'Converts Position given in NotMar in DMS to Latitude in Decimal Degrees
'Requires PositionDMS to follow format like: 45°46'03.2"N 080°36'58.8"W
' in-string pos: 12345678901234567890123456
'this argument is a string of 26 characters and gives position with one decimal for seconds for both Lon and Lat
'will assume western longitude (-)
'A sister function is LonDD
Dim Degs As Double, Mins As Double, Secs As Double

Degs = Val(Mid(PositionDMS, 14, 3))
Mins = Val(Mid(PositionDMS, 18, 2))
Secs = Val(Mid(PositionDMS, 21, 4))

LonDD = -(Degs + Mins / 60 + Secs / 3600)

End Function 'LonDD


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.