-->

How to convert degrees/minutes/seconds to decimal Degrees in Excel

How to convert degrees/minutes/seconds to decimal Degrees in Excel


كيفية تحويل الاحداثيات من دقائق ودرجات وثواني الى درجات عشرية ببرنامج الاكسل 

وذلك عن طريق كود Visual Basic داخل ملف الاكسل

Copy This Code



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 + secondsEnd Function
To Download This Code 
To use this function, create a conversion formula, as in the following example:
  1. Start Excel and press ALT+F11 to start the Visual Basic Editor.
  2. On the Insert menu, click Module.
  3. Enter the sample code for the Convert_Decimal custom function described above into the module sheet.
  4. Press ALT+F11 to return to excel.
  5. In cell A1 type the following formula:
    =Convert_Decimal("10° 27' 36")

TAG

عن الكاتب :

هناك تعليق واحد

  1. بارك الله فيك ونفع الله بعلمك يا استاذي
    ماذا عن تحويل Degree ,minute الى Dismal degree

    ردحذف

الاسم

بريد إلكتروني *

رسالة *