如何在MS-Access中执行三角函数Arc Cos(Excel中的ACOS())?

发布于 2025-01-01 23:45:14 字数 474 浏览 0 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一腔孤↑勇 2025-01-08 23:45:14

我找到了两种方法来做到这一点。第一个,也是我使用的,是对 ACOS() 函数使用等效的三角恒等式:

Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)

这对我来说会产生一个相当长的方程,但它可以工作,并且运行起来似乎不需要很长时间。我读过(但未测试)的另一个解决方案是创建一个

对 Microsoft Excel 对象库的引用(工具 | 参考
VBA 菜单栏)。这公开了 Excel 工作表函数,其中
您可以参考:

Excel.WorksheetFunction.ACOS(TheNumberGoesHere)

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:

Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)

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

reference to the Microsoft Excel Object Library (Tools | References on
the VBA menu bar). This exposes the Excel worksheet functions, which
you can reference with:

Excel.WorksheetFunction.ACOS(TheNumberGoesHere)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文