ID: Q73023
This article provides a sample Microsoft Excel macro type (XLM) to convert a degree value stored in decimal format (base 10) to degrees, minutes, and seconds as text. Microsoft Excel does not provide a number format to do this.
Fractions of a degree are commonly expressed in units called minutes and seconds. One degree is equivalent to 60 minutes, and similarly one minute equals 60 seconds. These units are most commonly used with nautical charts and navigation.
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/refguide/default.asp
The following function macro will accept an angle formatted as a decimal
number and convert it to degrees, minutes, and seconds as text.
A1: Convert_Degree
A2: =ARGUMENT("Decimal_Deg")
A3: =RESULT(2)
A4: Degrees=INT(Decimal_Deg)
A5: Minutes=(Decimal_Deg-Degrees)*60
A6: Seconds=ROUND((Minutes-INT(Minutes))*60,0)
A7: =RETURN(Degrees&"~ "&INT(Minutes)&"' "&Seconds&"""")
For example, entering =Convert_Degree(10.46) into a worksheet returns
10~ 27' 36" (10 degrees, 27 minutes, 36 seconds).
"User's Guide," version 4.0, pages 210-211
"User's Guide," version 3.0, pages 574-75
Additional query words: 7.00 3.0 3.00 4.0 4.00 4.0a 4.00a 5.00 xlm
Keywords : kbdta EPUCon KbVBA
Issue type : kbhowto
Last Reviewed: May 19, 1999