2011-11-16 20 views
0

私は約200緯度とformat-エクセル式計算

度、分のものであり、例えばのためseconds-私のExcelシート内の異なる場所の200点の経度持っている:44'

は36°34" を

この値を度+分/ 60 +秒/3600の式を使用して小数点に変換したいのですが、すべてのセルで同じ値を適用する方法を教えてください。すべての度、分、秒が同じセルに入っています。ありがとうございます。

答えて

2

使用している場合は、おそらく使用できるサンプルVBA関数です:

Function Convert_Decimal(Degree_Deg As String) As Double 
    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 

=Convert_Decimal("36°34"44'")と入力すると結果が36.58になります。

興味がある場合は、the other approachをご覧ください。時刻の書式機能を利用できます。

これらが役立つことを願っています。

MSDN上のいくつかの詳細:

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

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

http://www.cpearson.com/excel/LatLong.aspx

+0

おかげでたくさん...!本当に助けになりました! :D – Chandeep

0

ゼロパディングされたとして、あなたの文字列がない場合は(のような06°04"04')、その後

=VALUE(LEFT(A1,2))+VALUE(MID(A1,4,2))/60+VALUE(MID(A1,7,2))/3600 

を使用するか、不確かな(のような6°4"4')そしてここで

=VALUE(LEFT(A1,FIND("°",A1)-1)) + 
VALUE(MID(A1,FIND("°",A1)+1,FIND("""",A1)-FIND("°",A1)-1))/60 + 
VALUE(MID(A1,FIND("""",A1)+1,FIND("'",A1)-FIND("""",A1)-1))/3600