根据两个输入值在表中查找值
我非常熟悉 Excel 中的 vlookup
和 hlookup
函数。 然而,我正在寻找一种同时做到这两点的方法。 举个例子:
A B C
1 Resources
2 Task Mgr Sr. Mgr
3 -----------------------------
4 Task 1 30% 70%
5 Task 2 40% 60%
6 Task 3 50% 50%
7 Task 4 70% 30%
如果我想在新单元格中放入公式来查找任务和资源类型以返回适当的百分比,我该怎么做?
I am very familiar with vlookup
and hlookup
functions in Excel. However, I am looking for a method of doing both. Take this example:
A B C
1 Resources
2 Task Mgr Sr. Mgr
3 -----------------------------
4 Task 1 30% 70%
5 Task 2 40% 60%
6 Task 3 50% 50%
7 Task 4 70% 30%
If I wanted to put a formula in a new cell to look up both a task and a resource type to return the appropriate percentage, how could I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
INDEX 和 MATCH 的组合就可以解决问题:
A combination of INDEX and MATCH will do the trick:
另一种可能性:
其中
(eg Mgr)
Another possibility:
Where
(eg Mgr)
好的,假设您有一个具有以下格式的 Excel 工作表,其中查找表占据单元格范围 A1:E5
另外假设您想要分别在单元格 G3 和 H3 中输入行标题名称和列标题名称(我有文本值“R3”和“C2”)。
在您希望显示输出值的单元格中,您可以像这样使用 HLOOKUP:
或像这样使用 VLOOKUP:
要么在我的输出单元格中显示值“R3C2”。
Okay, assume you have an Excel sheet with the following format where your lookup table occupies the cell range A1:E5
Also assume you want to enter the row header name and column header name into cells G3 and H3 respectively (which I have the text values "R3" and "C2").
In the cell you wish to display your output value, you could either use HLOOKUP like so:
or VLOOKUP like so:
Either displays the value "R3C2" in my output cell.
当然,您可能会从其他单元格中获取要查找的内容,因此请将上面的“任务 3”和“Mgr”替换为对这些单元格的引用。
Of course, you're probably getting the things to look for from other cells, so replace "Task 3" and "Mgr" above with references to those cells.
Okokokok,所以
我刚刚想出了一个替代的、更简单的答案......它是一个 IF 函数!
好吧,我的意思如下;
您有 2 个输入单元格,均使用数据验证列表进行格式化。 一有任务,一有职位,如所提问题所示。
现在我们使用 vlookup 函数来确定我们要获取哪一行,然后使用 IF 函数来确定列!
现在假设您的输入单元格在 E1 和 F1 处彼此相邻
因此此公式的示例为
=vlookup($E$1,$A$4:$C$7,IF($F$1="MGR",2 ,3),FALSE)
这非常有效,甚至可以通过使用 IFS 函数与超过 2 列一起使用!
我希望这对未来的孩子有所帮助,他们做了我所做的事情,并在非常困惑后上网寻找答案哈哈哈
Okokokok so
I just figured out an alternate, much simpler answer... its an IF function!
so okay, what I mean by this is the following;
you have 2 input cells, both formatted with data validation lists. One has the tasks, and one has the position, as shown in the question asked.
now we use a vlookup function to determine what row we are going to get, and then an IF function to determine the column!!
now lets say your input cells are next to each other at E1 and F1
So an example of this formula would be,
=vlookup($E$1,$A$4:$C$7,IF($F$1="MGR",2,3),FALSE)
This works so well and can even be used with more than 2 columns by using the IFS Function!
I Hope this helps some kid in the future who did exactly what I did and went to the internet for answers after being very confused hahaha