In <news:p9fuj5$8b7$
1...@gioia.aioe.org>, Jeff <
je...@ukra.com> wrote:
> Write an Excel spreadsheet to do the conversion. It is not hard!!
Did you see the Microsoft Excel Visual Basic macro to convert just from
Degrees Minutes Seconds to decimal degrees?
https://support.microsoft.com/en-za/help/213449/how-to-convert-degrees-minutes-seconds-angles-to-or-from-decimal-angle
It's horrific.
How to convert DD to DMS.
1. Start Microsoft Excel 2007.
2. Press ALT+F11 to start the Visual Basic editor.
3. On the Insert menu, click Module.
4. Enter the code for the Convert_Degree custom function into the module
sheet.
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
5. Press ALT+F11 to return to excel.
6. In the Excel spreadsheet cell A1, type the DD of "10.46" (sans quotes).
7. In the Excell spreadsheet cell A2, type the following formula:
"=Convert_Degree(A1)" (sans quotes)
8. The formula returns the DMS of 10°27'36"
================
How to convert DMS to DD.
1. Start Microsoft Excel 2007.
2. Press ALT+F11 to start the Visual Basic editor.
3. On the Insert menu, click Module.
4. Enter the code for the Convert_Degree custom function into the module
sheet.
Function Convert_Decimal(Degree_Deg As String) As Double
' Declare the variables to be double precision floating-point.
Dim degrees As Double
Dim minutes As Double
Dim seconds As Double
' Set degree to value before "°" of Argument Passed.
degrees = Val(Left(Degree_Deg, InStr(1, Degree_Deg, "°") - 1))
' Set minutes to the value between the "°" and the "'"
' of the text string for the variable Degree_Deg divided by
' 60. The Val function converts the text string to a number.
minutes = Val(Mid(Degree_Deg, InStr(1, Degree_Deg, "°") + 2, _
InStr(1, Degree_Deg, "'") - InStr(1, Degree_Deg, _
"°") - 2)) / 60
' Set seconds to the number to the right of "'" that is
' converted to a value and then divided by 3600.
seconds = Val(Mid(Degree_Deg, InStr(1, Degree_Deg, "'") + _
2, Len(Degree_Deg) - InStr(1, Degree_Deg, "'") - 2)) _
/ 3600
Convert_Decimal = degrees + minutes + seconds
End Function
5. Press ALT+F11 to return to excel.
6. In the Excel spreadsheet cell A1, type the following formula:
=Convert_Decimal("10° 27' 36""")
7. The formula returns the DD of 10.46
Of course, they left out Degrees Minutes Seconds to decimal degrees as an
exercise for the reader! :)