bottom
Great ExcelTips!
         
Your e-mail address is safe!
Close Note

Tips.Net > ExcelTips Home > Formatting > Displaying Latitude and Longitude

Displaying Latitude and Longitude

Summary: If you work with geographic data, you may need a way to display latitude and longitude in a worksheet. This tip examines several different approaches you an take. (This tip works with Microsoft Excel 97, Excel 2000, Excel 2002, Excel 2003, and Excel 2007.)

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. Choose Cells from the Format menu. Excel displays the Format Cells dialog box. (To display the Format Cells dialog box in Excel 2007, it is easiest to press Ctrl+Shift+F.)
  3. Make sure the Number tab is selected. (Click here to see a related figure.)
  4. In the categories list, choose Custom.
  5. Place the insertion point in the Type box and erase whatever is there.
  6. Type three # signs.
  7. Hold down the Alt key and type 0176 on the numeric keypad. (This inserts the degree symbol.)
  8. Type a space, two zeros, an apostrophe (the single quote), and another space.
  9. Type two more zeros followed by two more apostrophes. (A quote mark won't work; it must be two apostrophes.)
  10. 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(B7), "0" & CHAR(176) & " ") & TEXT(INT((ABS(B7)
- INT(ABS(B7)))*60), "0' ") & TEXT(((((ABS(H7)-INT(ABS(B7)))*60)
- INT((ABS(B7) - INT(ABS(B7)))*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. Choose Cells from the Format menu. Excel displays the Format Cells dialog box. (Again, if you are using Word 2007 you display the Format Cells dialog box by pressing Ctrl+Shift+F.)
  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.

Tip #3016 applies to Microsoft Excel versions: 97 | 2000 | 2002 | 2003 | 2007


Got the Time? Understanding the ins and outs of working with times and dates can be confusing. Remove the confusion--ExcelTips: Times and Dates is an invaluable resource for learning how best to work with times and dates.
 
Check out ExcelTips: Times and Dates today!

Helpful Links

Ask an Excel Question
Make a Comment

Tips.Net Home

ExcelTips FAQ
ExcelTips Premium

Learn Access Now

Bugs and Pests Tips
ExcelTips
Family Tips
Health Tips
Home Tips
Organizing Tips
WordTips

Advertise on the
ExcelTips Site

 

Great Info!

Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your e-mail address and click "Subscribe."
     
(Your e-mail address will never be shared with anyone, ever.)