跳到主要内容

如何在Excel中对行或列中的匹配项进行vlookup和求和?

使用vlookup和sum函数可帮助您快速找出指定的条件并同时求和相应的值。 在本文中,我们将向您展示两种方法来vlookup并求和Excel中行或列中第一个或所有匹配的值。

Vlookup和总和与公式中的一行或多行匹配
Vlookup和求和项在具有公式的列中匹配
使用出色的工具轻松地对行或列中的vlookup和求和进行匹配

有关VLOOKUP的更多教程...


Vlookup和总和与公式中的一行或多行匹配

本节中的公式可以帮助根据Excel中的特定条件将一行或多行中的第一个或所有匹配值相加。 请执行以下操作。

Vlookup并将行中的第一个匹配值求和

假设您有一个水果表,如下面的屏幕快照所示,您需要查找表中的第一个Apple,然后将同一行中的所有对应值相加。 为此,请执行以下操作。

1.选择一个空白单元格以输出结果,这里我选择单元格B10。 将以下公式复制到其中,然后按 按Ctrl + 转移 + 输入 获得结果的键。

=SUM(VLOOKUP(A10, $A$2:$F$7, {2,3,4,5,6}, FALSE))

笔记:

  • A10 是包含您要查找的值的单元格;
  • $ A $ 2:$ F $ 7 是包含查找值和匹配值的数据表范围(不包含标题);
  • 数量 2,3,4,5,6 {} 表示结果值列以表格的第二列开始,并以表格的第六列结束。 如果结果列数大于6,请将{2,3,4,5,6}更改为{2,3,4,5,6,7,8,9…。}。
Vlookup并对多行中所有匹配的值求和

上面的公式只能对第一个匹配值的行中的值求和。 如果要返回多行中所有匹配项的总和,请执行以下操作。

1.选择一个空白单元格(在这种情况下,我选择单元格B10),将以下公式复制到其中,然后按 输入 获得结果的关键。

=SUMPRODUCT((A2:A7=A10)*B2:F7)

轻松在Excel中的行或列中进行vlookup和求和匹配:

查找和总和 实用程序 Kutools for Excel 可以帮助您快速查看和查找Excel中行或列中的匹配项,如下面的演示所示。
立即下载 Kutools for Excel 的全功能 30 天免费试用版!


具有公式的列中的Vlookup和总和匹配值

本节提供了一个公式,用于根据特定条件在Excel中返回列的总和。 如下面的屏幕截图所示,您正在水果表中查找列标题“ Jan”,然后对整个列值求和。 请执行以下操作。

1.选择一个空白单元格,将以下公式复制到其中,然后按 输入 获得结果的关键。

=SUM(INDEX(B2:F7,0,MATCH(A10,B1:F1,0)))


使用出色的工具轻松地对行或列中的vlookup和求和进行匹配

如果您不擅长应用配方,请在此处推荐您 Vlookup和总和 的特点 Kutools for Excel。 使用此功能,只需单击一下,您就可以轻松地对行或列中的匹配项进行vlookup和求和。

申请前 Kutools for Excel首先下载并安装.

Vlookup并对一行或多行中的第一个或所有匹配值求和

1。 点击 库工具 > 超级查找 > 查找和总和 启用该功能。 看截图:

2.在 查找和总和 对话框,请进行以下配置。

  • 2.1)在 查找和总和类型 部分,选择 在行中查找和总和匹配值 选项;
  • 2.2)在 查询值 框,选择包含您要查找的值的单元格;
  • 2.3)在 输出范围 框,选择一个单元格以输出结果;
  • 2.4)在 数据表范围 框,选择不包含列标题的表范围;
  • 2.5)在 附加选项 部分,如果您只想对第一个匹配的值求和,请选择 返回第一个匹配值的总和 选项。 如果要对所有匹配项的值求和,请选择 返回所有匹配值的总和 选项;
  • 2.6)点击 OK 按钮立即获得结果。 看截图:

备注:如果您要进行vlookup并汇总一列或多列中的第一个或所有匹配值,请检查 在列中查找和总和匹配值 对话框中的“选项”,然后配置为如下所示的屏幕截图。

有关此功能的更多详细信息, 请点击这里.

  如果您想免费试用(30天)此实用程序, 请点击下载,然后按照上述步骤进行操作。


相关文章

跨多个工作表的Vlookup值
您可以应用vlookup函数以返回工作表中的匹配值。 但是,如果您需要在多个工作表中使用vlookup值,该怎么办? 本文提供了详细的步骤来帮助您轻松解决问题。

Vlookup并在多列中返回匹配的值
通常,应用Vlookup函数只能从一列返回匹配的值。 有时,您可能需要根据条件从多个列中提取匹配的值。 这是您的解决方案。

Vlookup在一个单元格中返回多个值
通常,应用VLOOKUP函数时,如果存在多个符合条件的值,则只能获取第一个的结果。 如果要返回所有匹配的结果并将它们全部显示在一个单元格中,如何实现?

Vlookup并返回匹配值的整个行
通常,使用vlookup函数只能返回同一行中特定列的结果。 本文将向您展示如何根据特定条件返回整行数据。

向后Vlookup或反向
通常,VLOOKUP函数在数组表中从左到右搜索值,并且它要求查找值必须位于目标值的左侧。 但是,有时您可能知道目标值,并想找出相反的查找值。 因此,您需要在Excel中向后vlookup。 本文中有几种方法可以轻松解决此问题!

有关VLOOKUP的更多教程...

最佳办公生产力工具

🤖 Kutools 人工智能助手:基于以下内容彻底改变数据分析: 智能执行   |  生成代码  |  创建自定义公式  |  分析数据并生成图表  |  调用 Kutools 函数...
热门特色: 查找、突出显示或识别重复项   |  删除空白行   |  合并列或单元格而不丢失数据   |   不使用公式进行四舍五入 ...
超级查询: 多条件VLookup    多值VLookup  |   跨多个工作表的 VLookup   |   模糊查询 ....
高级下拉列表: 快速创建下拉列表   |  依赖下拉列表   |  多选下拉列表 ....
列管理器: 添加特定数量的列  |  移动列  |  切换隐藏列的可见性状态  |  比较范围和列 ...
特色功能: 网格焦点   |  设计图   |   大方程式酒吧    工作簿和工作表管理器   |  资源库 (自动文本)   |  日期选择器   |  合并工作表   |  加密/解密单元格    按列表发送电子邮件   |  超级筛选   |   特殊过滤器 (过滤粗体/斜体/删除线...)...
前 15 个工具集12 文本 工具 (添加文本, 删除字符,...)   |   50+ 图表 类型 (甘特图,...)   |   40+ 实用 公式 (根据生日计算年龄,...)   |   19 插入 工具 (插入二维码, 从路径插入图片,...)   |   12 转化 工具 (小写金额转大写, 货币兑换,...)   |   7 合并与拆分 工具 (高级组合行, 分裂细胞,...)   |   ... 和更多

使用 Kutools for Excel 增强您的 Excel 技能,体验前所未有的效率。 Kutools for Excel 提供了 300 多种高级功能来提高生产力并节省时间。  单击此处获取您最需要的功能...

产品描述


Office Tab 为 Office 带来选项卡式界面,让您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
Comments (26)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I need help with a formula. I have 2 sheets to pull data from and calculate the sum of on column with a match to a name.
I.e Name is in sheet 1 D5, the name in sheet 2 is B3 the amounts to calculate which match the name in B3 in sheet 2 is F3 to F32.
I've tried sum index, vlookup, match and so on but keep getting a 0. Can anyone assist with this?
This comment was minimized by the moderator on the site
Hi Marnel Strydom,
I don't know if I understand you correctly: If the name in D5 of Sheet1 matches the name in B3 of Sheet2, then sum numbers in the range F3:F32 of Sheet2.
If so, you can apply the following formula to get it done.
=SUM(INDEX(Sheet2!F3:F32,0,MATCH(Sheet1!D5,Sheet2!B3,0)))
This comment was minimized by the moderator on the site
I have a multi sheet spread sheet keeping track of job hours. I have used VLOOKUP in succession to sum all the hours on multiple sheets and it works great... Until it gets to a sheet that does not contain the lookup value. I have searched all over for my issue, and VLOOKUP may be the incorrect solution. I was wondering if I could rattle anyone's brain to make this work.

I.E. I have 1 excel document with 52 tabs. Each tab is a work week starting from January so WW1 is all the hours FOR sed jobs I did for that week. "joes house 2 hours ; mikes house 3 hours"... WW2, WW3 etc... Until WW52.

This is the function I made to add hours together...

=SUM(VLOOKUP(O30,'WW29'!$A$7:$M$110,{13},FALSE),VLOOKUP(O30,'WW30'!$A$7:$M$110,{13},FALSE),VLOOKUP(O30,'WW31'!$A$7:$M$110,{13},FALSE)) And it works great. But when that job is finished it is not on (for example WW32 tab). Hence I get the #N/A error. so for example, as the previous one works great when I expand the formula to cover all 52 sheets... (EXAMPLE OF NEXT PAGE WIOTHOUT LOOKUP VALUE)

=SUM(VLOOKUP(O30,'WW29'!$A$7:$M$110,{13},FALSE),VLOOKUP(O30,'WW30'!$A$7:$M$110,{13},FALSE),VLOOKUP(O30,'WW31'!$A$7:$M$110,{13},FALSE),VLOOKUP(O30,'WW32'!$A$7:$M$110,{13},FALSE)) I get the #N/A error because the job is not listed on WW32. But I may add hours to that on WW45.

Is there a way to make VLOOKUP skip a sheet that does not have the referenced value and continue summing it till the end? I apologize, this may be as clear as mud but I will clarify anything if need be.

I have also tried IFERROR. You can set IFERROR to return text or even blanks, but does not seem to cover summing. I'm looking for how to SUM multiple sheets when some of the sheets do not contain the lookup value. When using IFERROR function, instead of RETURNING #N/A it just returns "YOU'VE ENTERERED TOO MANY ARGUMENTS FOR THIS FUNCTION"...

=IFERROR(VLOOKUP(O30,'WW29'!$A$7:$M$110,{13},FALSE),VLOOKUP(O30,'WW30'!$A$7:$M$110,{13},FALSE),VLOOKUP(O30,'WW31'!$A$7:$M$110,{13},FALSE),VLOOKUP(O30,'WW32'!$A$7:$M$110,{13},FALSE),"")

And that's just 3 sheets.

Any help would be greatly appreciated.

P.S. I have tried with CTRL+SHIFT+ENTER as well to no avail.
This comment was minimized by the moderator on the site
Hi Joe,
The methods provided in the following article can do you a favor. Please give it a try. Hope I can help.
How To Vlookup Across Multiple Sheets And Sum Results In Excel?
This comment was minimized by the moderator on the site
A B C D E F
1 I want this cells in col B to sum the values in col F7 (today) to say F20. this will reduce as tomorrow it will sum the values from F8:F20 and so on -$19 I
want this cells in column B to sum the values in col F7 (today) to say F10.
this will reduce as tomorrow it will sum the values from F8:F10 and so on

2 Fri 22 Jul 22 -$19
3 Sat 23 Jul 22 -$19
4 Sun 24 Jul 22 -$19
5 Mon 25 Jul 22 -$19
6 Tue 26 Jul 22 -$19
7 Wed 27 Jul 22 -$19 tried with vlookup, needless to say it doesn't work
8 Thu 28 Jul 22 -$19 =L8=(D1-E1)+SUM(vlookup(today(),6,false):F28)
9 Fri 29 Jul 22 -$19
10 Sat 30 Jul 22 -$19
11 Sun 31 Jul 22 -$19
12 Mon 01 Aug 22 -$19
13 Tue 02 Aug 22 -$19
14 Wed 03 Aug 22 -$19
15 Thu 04 Aug 22 -$19
This comment was minimized by the moderator on the site
hi
How can I add multiple vlookups together and sum it up ?


=VLOOKUP(E3,'Waste Process NEW'!N:O,2,FALSE) --------------- for this everything goes fine except that retune valve is only the first one where N column have many values match's lookup values of E3.


using index didn't help and shows #N/A
=SUM(INDEX('Waste Process NEW'!N:N,0,MATCH('Monthly Report'!H5,'Waste Process NEW'!1:1048576,0)))
This comment was minimized by the moderator on the site
Hi tariq,
Would you mind providing a screenshot of your data? Sorry for the inconvenience.
This comment was minimized by the moderator on the site
I just get a #VALUE! when I try to do all matched values, but it works for the first value. Any idea?
This comment was minimized by the moderator on the site
How can I add multiple vlookups together, for example I want to look up from your example Apples + oranges + bananas for January.Is there a way to do this?
This comment was minimized by the moderator on the site
I'm having trouble with a similar formula I feel like I need to use an index but can't figure it out. I'm trying to get the sum but the lookup is based on 2 values. Column D which contains an employee's extension and column I which provides a logout code. The goal is to find the sum of time in column K based on a specific employee (column D) and the logout code (column I).
This comment was minimized by the moderator on the site
Hi Mike,
Do you mind uploading a screenshot of your data?
This comment was minimized by the moderator on the site
Thanks but I was able to get my formula up and running with a sumifs calculation. Sumifs giving the sum of something based on multiple factors. Mine being an employee ID number and a status code.
This comment was minimized by the moderator on the site
what will be the formula to add qty of apple in jan only
This comment was minimized by the moderator on the site
the =SUM(PRODUCT((A2:A7=A11)*B2:I7) is not working with decimal point.
This comment was minimized by the moderator on the site
For me works just fine. Try without separating SUM and Product, it should be =SUMPRODUCT((A2:A7=A11)*B2:I7)
This comment was minimized by the moderator on the site
can one sum things up in a column and not a row?
This comment was minimized by the moderator on the site
Hi Jelly,
This formula =SUM(INDEX(B2:F9,0,MATCH(A12,B1:F1,0))) can help you solve the problem. Please have a try. Hope I can help.
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations