[英]Excel using vlookup with index address match
I have a table similar to the one on the left in the image below. 我有一张类似于下图中左侧表格的表格。 For each location, there are either 3 or 4 types.
对于每个位置,有3种或4种类型。 There are always Types 1, 2, and 4. Sometimes there is also a type 3. I need to find the type4 QtyC value for each location (highlighted in yellow) and move it to a table on the right.
总是有Type 1、2和4。有时也有Type3。我需要找到每个位置的type4 QtyC值(以黄色突出显示)并将其移到右侧的表中。 An example of a single row of that table can be seen on the right in the image below.
该表的单个行的示例可以在下图的右侧看到。 In the example below, I am trying to move Location1, Type4, QtyC from cell E5 to cell I2 so that the end result should be 9 as highlighted in the table on the right.
在下面的示例中,我尝试将Location1,Type4,QtyC从单元格E5移动到单元格I2,以便最终结果应为9,如右表中突出显示的那样。
My thought was that I could use VLOOKUP in combination with OFFSET, ADDRESS, and MATCH, but Excel generates an error when I try to do this. 我的想法是我可以将VLOOKUP与OFFSET,ADDRESS和MATCH结合使用,但是当我尝试执行此操作时,Excel会产生错误。
In the image above, you can see that: 在上图中,您可以看到:
=VLOOKUP(H2,OFFSET(A3,0,1,4,4),4,FALSE)
...returns 9 which is expected ...返回预期的9
=ADDRESS(MATCH(G2,A:A,0),1,4,1)
...returns A3 which is expected, but ...返回预期的A3,但
=VLOOKUP(H2,OFFSET(ADDRESS(MATCH(G2,A:A,0),1,4,1),0,1,4,4),4,FALSE)
...returns an error. ...返回错误。
I suspect it has something to do with the order in which excel is performing the calculations, but I can't seem to figure out a way to resolve this. 我怀疑这与excel执行计算的顺序有关,但我似乎无法找出解决此问题的方法。
Any help or advice is appreciated! 任何帮助或建议,不胜感激!
Thanks 谢谢
The A3
in the OFFSET
formula is not a string but a cell reference. OFFSET
公式中的A3
不是字符串,而是单元格引用。 But ADDRESS
will return a string and not a cell reference. 但是
ADDRESS
将返回字符串,而不是单元格引用。 INDEX
will return a cell reference. INDEX
将返回单元格引用。
So 所以
=VLOOKUP(H2,OFFSET(INDEX(A:A,MATCH(G2,A:A,0)),0,1,4,4),4,FALSE)
should do what you want. 应该做你想做的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.