ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 Excel Home精品图文教程库
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
300集Office 2010微视频教程 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
查看: 37515|回复: 12

[已解决] 关于度分秒怎么转换成为度

[复制链接]

TA的精华主题

TA的得分主题

发表于 2004-10-14 00:24 | 显示全部楼层 |阅读模式
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册

比如10度30分48秒。怎么转换为10.58度(最简单的办法)反之怎么处理。

怎么让表格中的数字怎么显示为10°30’48”

评分

1

查看全部评分

TA的精华主题

TA的得分主题

 楼主| 发表于 2004-10-14 10:30 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2004-10-14 11:09 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项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~ 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""")

TA的精华主题

TA的得分主题

发表于 2004-10-14 11:12 | 显示全部楼层

办公大哥,太复杂了。

晕!

[em06][em06]]

是不时从哪里拷贝过来的,连注释都是英文的。最好是中文的注释方便初学者看懂。

[此贴子已经被作者于2004-10-14 11:13:31编辑过]

TA的精华主题

TA的得分主题

发表于 2004-10-14 11:12 | 显示全部楼层

这是shangyu斑竹的做法,请参考:

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

TA的精华主题

TA的得分主题

发表于 2004-10-14 11:29 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助

度、分、秒与时间一样是60进制的,用时间格式输入。

另:TO办公之星:什么时候把学会这么复杂的自定义函数?

[此贴子已经被作者于2004-10-14 11:30:33编辑过]

TA的精华主题

TA的得分主题

发表于 2004-10-14 11:38 | 显示全部楼层
又向 shangyu版主, Fieldsun 版主,gvntw 版主,学了一招,谢谢!

TA的精华主题

TA的得分主题

发表于 2004-10-14 11:58 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
以下是引用gvntw在2004-10-14 11:29:00的发言:

度、分、秒与时间一样是60进制的,用时间格式输入。

另:TO办公之星:什么时候把学会这么复杂的自定义函数?

抄别人的,好像是爱米莉斑竹的。

英文名字,不一定记得准了。

TA的精华主题

TA的得分主题

发表于 2004-10-14 12:03 | 显示全部楼层
以下是引用fieldsun在2004-10-14 11:23:00的发言:

建议单元格输入时为时间格式:如A1输入10:30:48,自定义格式[h]°m′s″

换为度的公式=A1*24,设为常规格式

斑竹总是能够突发奇招,喜欢。

TA的精华主题

TA的得分主题

发表于 2004-10-14 11:23 | 显示全部楼层

建议单元格输入时为时间格式:如A1输入10:30:48,自定义格式[h]°m′s″

换为度的公式=A1*24,设为常规格式

您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-4-30 18:56 , Processed in 0.038660 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表