Thread: Degrees
View Single Post
 
Old 09-16-2013, 10:05 AM
weskusjaco weskusjaco is offline Windows 7 32bit Office 2010 32bit
Novice
 
Join Date: Sep 2013
Posts: 2
weskusjaco is on a distinguished road
Default

Quote:
Originally Posted by OTPM View Post
Hi
Have a look at this link.

http://support.microsoft.com/kb/213449

Good luck.
Tony

Hi

I would like to have this without doing the seconds separate, just as a decimal to the minutes

Converting Decimal Degrees to Degrees/Minutes/Seconds

The following Microsoft Visual Basic for Applications custom function accepts an angle formatted as a decimal value and converts it to a text value displayed in degrees, minutes, and seconds.

Function Convert_Degree(Decimal_Deg) As Variant
With Application
'Set degree to Integer of Argument Passed
Degrees = Int(Decimal_Deg)
'Set minutes to 60 times the number to the right
'of the decimal for the variable Decimal_Deg
Minutes = (Decimal_Deg - Degrees) * 60
'Set seconds to 60 times the number to the right of the
'decimal for the variable Minute
Seconds = Format(((Minutes - Int(Minutes)) * 60), "0")
'Returns the Result of degree conversion
'(for example, 10.46 = 10~ 27 ' 36")
Convert_Degree = " " & Degrees & "° " & Int(Minutes) & "' " _
& Seconds + Chr(34)

End With
End Function

To use this function, create a conversion formula, as in the following example:
Start Excel and press ALT+F11 to start the Visual Basic editor.
On the Insert menu, click Module.
Enter the sample code for the Convert_Degree custom function described above into the module sheet.
Press ALT+F11 to return to excel.
In cell A1 type 10.46.
In cell A2 type the following formula:
=Convert_Degree(A1)
Reply With Quote