如何在MS-Access中执行三角函数Arc Cos(Excel中的ACOS())?
我有一个 Excel 公式,需要将其放入 MS-Access 查询中。不幸的是,反余弦函数似乎并不属于 Access 的功能。所以在Excel中,公式的一部分是ACOS(很多东西)。所以我的问题是如何在 MS-Access 中实现 ACOS() Excel 函数?
注意:如果有人想知道或者由于某些奇怪的原因它实际上很重要,下面是 Excel 中显示的完整方程式:
=(ACOS(SIN(弧度(AX2))*SIN(弧度(AZ2))+COS(弧度(AX2))*COS(弧度(AZ2))*COS(弧度(AY2)-弧度(BA2) ))*6367)*0.621
列 AX 和 AZ 保存纬度,AY 和 BA 保存经度,该方程得到两点之间的距离(以英里为单位)。在有人提出这个问题之前,我就知道 Access 没有 Radians 函数。我已经用等效操作替换了它。当然,我已将列引用从 Excel 更改为相应的 Access 字段引用。
I have an excel formula that I need to put into an MS-Access query. Unfortunately, an Arc Cosine function does not seem to be part of Access's repertoire. So in Excel, part of the formula is ACOS(Lots of stuff). So my question is how can I achieve an ACOS() Excelfunction in MS-Access?
Note: In case anyone is wondering or in case it actually matters for some odd reason, here is the full equation as it appears in Excel:
=(ACOS(SIN(RADIANS(AX2))*SIN(RADIANS(AZ2))+COS(RADIANS(AX2))*COS(RADIANS(AZ2))*COS(RADIANS(AY2)-RADIANS(BA2)))*6367)*0.621
Columns AX and AZ hold latitudes and AY and BA hold longitudes and this equation gets the distance in miles between the two points. And before anyone brings it up I am aware that Access doesn't have Radians function. I have already replaced it with an equivalent operation. I of course have changed the column references from Excel to the appropriate Access field references.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了两种方法来做到这一点。第一个,也是我使用的,是对 ACOS() 函数使用等效的三角恒等式:
这对我来说会产生一个相当长的方程,但它可以工作,并且运行起来似乎不需要很长时间。我读过(但未测试)的另一个解决方案是创建一个
I have found two ways to do this. The first, and the one I used, is to use an equivalent trig identity for the ACOS() function:
This results in a rather long equation for me but it works and does not appear take very long to run. The other solution I have read about (but not tested) is to create a