Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. 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: Exporting Latitude and Longitude.

Exporting Latitude and Longitude

Written by Allen Wyatt (last updated February 1, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365


2

Deidre uses an Excel worksheet to store latitude and longitude values. These values are entered in cells in the format 26:05:35, which Excel interprets as hours, minutes, and seconds. Internally, Excel converts the entry into an internal date value. This means that the value is stored internally as the serial number 1.08721064814815, but is displayed, automatically, in the elapsed time format.

Deidre is running into a problem when she tries to use the data in the worksheet with a different program that needs the latitude and longitudes values in text format. In other words, she needs them in a text file in the format 26:05:35, not in some other date/time representation that may be picked by Excel.

The first thing to try is to select all the cells that contain latitudes and longitudes, and make sure they are formatted properly. Follow these steps:

  1. Select all the cells.
  2. Press Ctrl+Shift+F. Excel displays the Format Cells dialog box.
  3. Make sure the Number tab is displayed.
  4. Make sure that Time is selected in the Category list. (See Figure 1.)
  5. Figure 1. The Number tab of the Format Cells dialog box.

  6. Make sure that 37:30:55 is selected in the Type list. (This is the elapsed time format.)
  7. Click on OK.

Now you should be able to save the file in text format, and the latitudes and longitudes will look as expected:

  1. Save your workbook in regular Excel format.
  2. Press F12. Excel displays the Save As dialog box.
  3. Using the Save As Type drop-down list, indicate that you want to save the worksheet as Text (Tab Delimited).
  4. Use the other controls in the dialog box to specify a location and file name for the text file.
  5. Click on Save. Excel reminds you that you will lose formatting and some features by saving the file in text format. That's OK; it is the reason you saved the file in Excel format in step 1.

When done, you should be able to open the Excel-created text file and see that it contains the latitudes and longitudes in the format wanted. If it doesn't (for some bizarre reason), then you should try the following:

  1. Insert an empty column to the right of your latitudes or longitudes. (In this example, I assume that the latitudes or longitudes are in column A, and you insert a blank column at B.)
  2. In the cell to the right of the first latitude or longitude (assume that value is in A3, so you would choose B3), enter the following formula:
  3.      =TEXT(A3,"[h]:mm:ss")
    
  4. Copy the formula down to all the other cells that need converting.
  5. Select all the formulaic cells in column B.
  6. Press Ctrl+C to copy them all to the Clipboard.
  7. Select cell A3.
  8. Display the Home tab of the ribbon.
  9. Click the down-arrow at the bottom of the Paste tool and then choose Paste Special. Excel displays the Paste Special dialog box. (See Figure 2.)
  10. Figure 2. The Paste Special dialog box.

  11. Make sure the Values option is selected.
  12. Click on OK. Excel pastes just the values—the text values—into the original cells.
  13. Delete column B.

The formula used in step 2 probably bears some explanation. It takes the value in A3 (the date serial value) and formats it as elapsed time, but as text. This is the format in which you ultimately want the values. You should now be able to save your worksheet as a text file (use the steps provided earlier in this tip), and the latitudes and longitudes should be formatted as expected.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (8393) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Exporting 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

Adjusting Spell Check for Internet Addresses

When you check the spelling of worksheet data, you may want to spell checker to either ignore or check Internet addresses ...

Discover More

Using RD Fields with Chapter Headings

The RD field can be handy for pulling together a bunch of documents into a single file. However, using the field can play ...

Discover More

Checking Lock Status of Cells

When you first create a worksheet, all the cells in that worksheet are formatted as locked. As you unlock various cells ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (ribbon)

Specifying Font Color in a Formula

Do you need to change text color based on the result of a formula? This tip provides a couple of ways you can accomplish ...

Discover More

Number Formatting Shortcuts

Keyboard shortcuts can save time and make developing a workbook much easier. Here's how to apply the most common of ...

Discover More

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
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 2 + 2?

2023-02-04 05:46:55

Tomek

Regarding Step 5 in the first group:
"5. Make sure that 37:30:55 is selected in the Type list. (This is the elapsed time format.)"

Such option is not available on my MS 365 Family under Win 10
I have to use custom format: [h]:mm:ss


2023-02-04 01:30:09

Tomek

I am dealing with conversions of Latitude and Longitude data frequently, as I am sailing, and I like to keep my nautical charts up to date. I am surprised about the format Deidre is using as it is one of Excel time formats, therefore Excel stores it as a serial number it is normally using for dates and times. As the result of that, the underlying number is not equal to the value of Latitude or Longitude. This can cause some confusion and errors. Yes, it can be easily converted to true Latitude or Longitude simply by multiplying it by 24; the result would be expressed as degrees with decimal fractions if formatted as General number.

Now, I understand that Deidre is dealing with an existing program that requires Latitude and Longitude data in text format using “:” as delimiter, and probably cannot change that. Also, I have seen this format on some websites dealing with airspace and borders, so there may be organizations that use this format.
I suggest that other users adhere to one of other commonly accepted, formats if they can.

No GPS, chart plotter, or navigation program I used, would accept the position information formatted with colons as delimiters. Most will accept decimal degrees e.g, 44.9999, -79.9300, or format like 44°59'59.6"N 79°55'48.0"W (negative is for western hemisphere).
Even Google Maps will accept these last two formats. It is actually very accommodating and will accept the position above given as 44 59 59.6, -79 55 48.0 or 44 59 59.6 N 79 55 48.0 W, with space delimiting degrees, minutes and seconds. Just for clarity, Latitude and Longitude should be entered as one line in search box (Google, or Google Maps) in the order written above.

Google will not, however, accept 44:59:59.6, -79:55:48.0 as search term for location.

Having said that, I see that there may be value in entering the data using Deidre’s format; after all it is easier to type in 44:59:59 than 44°59’59”. Once entered, the position values can be converted in the next column. Assuming that the value entered is in A3, In cell B3 put the formula:
   = A3*24     to convert to decimal degrees
   = TEXT(A3,"[h]\°mm\’ss\”")     to convert to Deg Min Sec (DMS) format as text
   = TEXT(A3,"[h] mm ss.0")     to convert to DMS text with space delimiters and fractions of seconds.
While converting you can add a negative sign for western and southern hemispheres, or append one of NEWS, e.g.:
   = TEXT(A3,"[h] mm ss.0") & “N”
   =”-“ & TEXT(A3,"[h]\°mm\’ss\”")
   =-A3*24
BTW: the degree sign can be entered by Alt+248 or Alt+0176.


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.