[英]How to sum a row in Excel with lookup values from a column based lookup?
I have rows of values in columns AC to AU (but also some blanks) 我在AC到AU列中有值行(还有一些空白)
I want to convert these values in a formula via a lookup and sum all the lookup values in a row. 我想通过查找将这些值转换为公式,并将所有查找值求和。
For 1 cell I can use VLOOKUP(AC2,'Lookup_Table'!A2:B41,2) successfully 对于1个单元格,我可以成功使用VLOOKUP(AC2,'Lookup_Table'!A2:B41,2)
How do I sum the whole row of AC2 to AU2 with this kind of lookup? 如何通过这种查找将整个AC2行与AU2相加?
Note the lookup is column oriented in a vertical lookup, the 'Lookup Table' is actually a worksheet. 注意,查找是在垂直查找中面向列的,“查找表”实际上是一个工作表。
This has stumped me for hours now! 这已经困扰了我几个小时!
| AC | AD | AE ..Ax... AU
Row 1 | 12 | 23 | 43 ..00... 67
'Lookup table' worksheet
A | B
12 | 4
23 | 2
43 | 3
67 | 5
The result should be 14 for the sample Row 1 data above 对于上面的示例行1数据,结果应为14
It is much easier to use an array formula ( ctrl+shift+enter
instead of just enter
). 使用数组公式(
ctrl+shift+enter
而不是仅仅enter
)要容易得多。 Generally I don't like array formulas (because they are easy for the uneducated to break), but I think it will work the best in your situation apart from reformatting your sheet or using helper columns. 通常,我不喜欢数组公式(因为它们很容易受过高等教育而无法使用),但我认为除了重新设置工作表格式或使用辅助列之外,它在您的情况下效果最好。
{=SUM(IF(AC2:AU2=Lookup_Table!A2:A41,Lookup_Table!B2:B41))}
which should have {} around the whole thing if you entered it correctly. 如果您输入正确,则整个内容应包含{}。
You need to use a combination of SUM
and INDEX
functions, where AB in Lookup_Table is your index column for the table, and A! 您需要结合使用
SUM
和INDEX
函数,其中Lookup_Table中的AB是表的索引列,而A! is the value you wish to lookup: 是您希望查找的值:
=SUM(INDEX(Lookup_Table!$AC$1,MATCH(A1,Lookup_Table!$AB:$AB,0)):INDEX(Lookup_Table!$AU$1,MATCH(A1,Lookup_Table!$AB:$AB,0)))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.