Excel.Tips.Net Welcome toExcel.Tips.Net

Helpful Links

Tips.Net Home
ExcelTips Home
Ask an Excel Question
Make a Comment

Tips.Net Store

ExcelTips FAQ
ExcelTips Premium

Learn Access Now
Free Printable Forms

Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Legal Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Wedding Tips
Word2007 Tips
WordTips

Advertise on the
ExcelTips Site

Newest Tips

Converting to Octal

Filtering Columns for Unique Values

Printing Multiple Worksheets on a Single Page

Changing the Default Font

Creating a Drawing Object

Determining a Value of a Cell

Understanding Macros

 

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.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3016) applies to Microsoft Excel versions: 97 | 2000 | 2002 | 2003 | 2007

Don't Go in Debt for Christmas! Tired of trying to keep up with the Joneses for Christmas? Want to enjoy the season rather than dread the aftermath? Learn how you can avoid the financial traps that spring up every Christmas.
 
Check out Top Fifteen Tips for Financing Christmas today!