You could use a UDF:
|
A |
B |
C |
1 |
12°34'56.78"S |
-12.5824 |
B1: =DMS2Deg(A1) |
2 |
12°3'45.67"N |
12.06269 |
|
Function DMS2Deg(ByVal s As String) As Double
Dim iSgn As Long
' Converts dd° mm' ss.ss{N|E|S|W}" to decimal degrees
s = Replace(s, " ", "")
Select Case UCase(Right(s, 1))
Case "N", "E"
iSgn = 1
s = Left(s, Len(s) - 1)
Case "S", "W"
iSgn = -1
s = Left(s, Len(s) - 1)
End Select
s = Replace(s, "°", "+") ' replace the degree sign
s = Replace(s, "'", "/60+") ' replace the minute sign
s = Replace(s, """", "/3600") ' replace the second sign (double quote)
s = Replace(s, "''", "/3600") ' replace the second sign (two single quotes)
If Left(s, 1) = "-" Then
DMS2Deg = -iSgn * Evaluate(Mid(s, 2))
Else
DMS2Deg = iSgn * Evaluate(s)
End If
End Function
Bookmarks