从表中查找值
Please I want to write a formula to get the Distance (4th column) between From and To Cities (2nd and 3rd columns) for a particular Order ID (1st column) in Table 1 while looking up data from the Distances worksheet as shown below.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用单元格 D2 中使用的 XLOOKUP() 函数
公式 -->
适用于 Excel 2021 和 Excel 2021仅限 O365 用户
因此,第二个
XLOOKUP()
函数返回返回从以下任一位置获取的距离 (km)
B
列中列出的到达堪培拉的地点,因为我以第一个单元格为例,所以它显示的是堪培拉,这就是对于C
列中的其他 Destination 也是如此,最后将其包装在另一个
XLOOKUP()
函数中,其中查找值来自于列B
应返回准确的距离 必需的。3 个替代公式:
• 对于所有用户
• 对于 Office 365 和 Office 365 Excel 2021
• 适用于 Office 365 和 Office 365 Excel 2021
注意:为了方便起见,我在同一工作表中显示了两个表,因此您可能需要根据您的数据库相应地更改范围。
Using XLOOKUP() Function
Formula used in cell D2 -->
Applicable To Excel 2021 & O365 Users Only
So, the second
XLOOKUP()
Function returnsReturns the Distance (km) that takes from any of the places listed in Column
B
to reach Canberra, since I have taken the first cell as an example so its showing for the Canberra, this goes same for the other Destinations in ColumnC
Lastly wrapping this one within another
XLOOKUP()
Function where the lookup value is from the ColumnB
shall return the exact distance required.3 Alternative formulas:
• For All Users
• For Office 365 & Excel 2021
• For Office 365 & Excel 2021
Note: For convenience I have shown both the tables in same worksheet, hence you may need to change the ranges accordingly as per your database.
这是一个快速版本:
B8为起点,B9为终点。
没有重复您的所有数据,因为您将其作为图片提供,我懒得输入所有这些数据。
So a quick version:
B8 is the starting point, B9 end.
Did not repeat all your data as you gave it as a picture and I am too lazy to type all of that.
您可以使用 AVERAGEIFS 轻松完成此操作:
单元格 H4 中的公式:
拖至左侧并拖至底部。
您需要使用 AVERAGEIFS,因为点之间的距离在两个方向上相同。因为在您的数据中,您在 OrderId 2 中获得了
Melbourner - Sidney
,并在 OrderId 4 中获得了Sidney - Melbourne
。这是相同的重复距离,因此如果您只是求和,你会产生一个错误。You can do it easily with AVERAGEIFS:
Formula in cell H4:
Drag to left and drag to bottom.
You need to use AVERAGEIFS because distance between points is the same in both directions. Because in your data yo got, as example,
Melbourner - Sidney
in OrderId 2 and gotSidney - Melbourne
in OrderId 4. It's the same distance duplicated so if you just sum, you will create an error.