乔山办公网我们一直在努力
您的位置:乔山办公网 > excel表格制作 > <em>EXCEL</em>中如何实现角度度分秒的输入以及数据处理

<em>EXCEL</em>中如何实现角度度分秒的输入以及数据处理

作者:乔山办公网日期:

返回目录:excel表格制作


你可以按文本形式输入度和分,也可以按小数形式输入,如31.05表示31度5分。但是计算的函数要能够zd理解你输入的含义,如05表示的是分,而不是0.05度就行。因此,转换函数你要自己写。
发个例子上来我可以帮你搞定,要讲清楚转换成什么单位。
另外,提问最好提供示例文件,以便人家帮你,这是基本要求了。

可以设置单元格格式使数值显示为度分秒样式000"°"00"′"00"″"
但是要参与计算的话还得进行转换,转换为弧度或度以后可以进行三角函数计算
  • 利用公式转度分zd秒:=TEXT(B6/24,"[h]°m′sss.000″")


  • 经度更高:=TEXT(INT(A1),"0")&"°"&TEXT(INT((A1-INT(A1))*60),"00")&"′"&TEXT(((A1-INT(A1))*60-INT((A1-INT(A1))*60))*60,"00.0000")&""""



用这个VBA代码,能实现你说的
MicroSoft FAQ

Converting Decimal Degrees to Degrees/Minutes/Seconds

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~e799bee5baa6e79fa5e98193e59b9ee7ad94365 27 \' 36")
Convert_Degree = " " & Degrees & "° " & Int(Minutes) & "\' " _
& Seconds + Chr(34)
End With
End Function

Example:
A1 =10.6
B1 = Convert_Degree(A1)

Converting Degrees/Minutes/Seconds to Decimal Degrees

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

Example:
=Convert_Decimal("10° 27\' 36""")

相关阅读

关键词不能为空
极力推荐

ppt怎么做_excel表格制作_office365_word文档_365办公网