나는 그것을 많이 봤지만 어떤 해결책도 찾지 못했습니다. 나는 Lat Long 데이터 (도, 분, 초)를 10 진수로 변환하려고합니다.excel에서 십진수로도/분 단위로 나누는 방법은 무엇입니까?
전통적으로 위도 긴 데이터 25°43'21.3"
같다,하지만도 (°) 기호가없는 일하고 있어요 데이터베이스는이 점을 가지고 (.) degree.For가 25.43'21.3"
그래서 무엇 일 것입니다 예 - 대신 25.43'21.3"
을 십진수로 변환하는 스크립트 - 25.722583333333333
??
데이터가 (°) 기호와 함께 제공되면 다음 코드가 작동합니다.
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
단지'''와 "°"' –
어떻게 작업을 대체 할 대체? 데이터에 몇 개의 점 (.)이 포함되어 있습니다. – netmaster
'InStr'은 첫 번째'.'의 위치를 반환합니다. 찾았습니다. –