简体   繁体   English

如何在 MS excel 中使用索引匹配公式求和

[英]How to sum with index match formula in MS excel

I would like to sum the data in column F (Sheet1) and show the result in column B (Sheet1)(From B4 to B9).我想对 F 列(Sheet1)中的数据求和,并在 B 列(Sheet1)(从 B4 到 B9)中显示结果。 But the sum range should be created using vlookup or index/match.但是应该使用 vlookup 或索引/匹配来创建总和范围。

The column E in sheet1 matched with Column B in sheet2 and take the column A values in sheet2. sheet1 中的 E 列与 sheet2 中的 B 列匹配,并取 sheet2 中的 A 列值。 Then sum the data in column F (Sheet1)然后对 F 列(Sheet1)中的数据求和

=SUMIF(E4:E13;VLOOKUP(A4;Sheet2!A17:B30;2;FALSE);F4:F13)
=SUMIF(E4:E13;INDEX(A17:A30;MATCH(A4;Sheet2!B17:B30;0);1);F4:F13)

I used the formula above but its not working.我使用了上面的公式,但它不起作用。 Vlookup takes only first value And index macth showing wrong number. Vlookup 只取第一个值和索引 macth 显示错误的数字。

Can anyone help me?谁能帮我? Thanks谢谢

苏米夫

Plz try this starting in B4:请从 B4 开始尝试这个:

=SUMPRODUCT(F$4:F$13*COUNTIFS(A$17:A$30;A4;B$17:B$30;E$4:E$13))

(I am testing this in Excel 365 - it may need array entering in Excel 2010). (我在 Excel 365 中对此进行测试 - 它可能需要在 Excel 2010 中输入数组)。

在此处输入图像描述

Assumes there are no duplicates in the Sheet2 data - if there were, you would need:假设 Sheet2 数据中没有重复项 - 如果有,您将需要:

=SUMPRODUCT(F$4:F$13*(COUNTIFS(A$17:A$30;A4;B$17:B$30;E$4:E$13)>0))

在此处输入图像描述

In case a 2 steps solution may work for you, you can do:如果两步解决方案可能适合您,您可以执行以下操作:

  1. Formula in cell C17 is =IFERROR(VLOOKUP(B17;$E$4:$F$13;2;FALSE);0)单元格 C17 中的公式为=IFERROR(VLOOKUP(B17;$E$4:$F$13;2;FALSE);0)
  2. Formula in cell B4 is =SUMIF($C$17:$C$30;$A$17:$A$30;A4)单元格 B4 中的公式为=SUMIF($C$17:$C$30;$A$17:$A$30;A4)

Drag down both formulas下拉两个公式

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM