简体   繁体   English

根据相似的单元格值添加单元格

[英]Add cells based on similar cell value

I'm having a bit of a problem with my spreadsheet. 我的电子表格存在一些问题。 I want to cells on Column L based on Column B. Column is Total while Columns B is the order number. 我想要基于列B的列L上的单元格。列是总计,而列B是订单号。

Here's what it looks like but it's longer I just screenshot the first 4 cells: 看起来是这样,但是更长了,我只是截取了前4个单元格的屏幕截图:

1 1个

I want to add the cells in Column L if their corresponding cells in Column B match. 如果列B中的相应单元格匹配,我想在列L中添加单元格。 Here's the formula I'm using. 这是我正在使用的公式。

SUMIF($B$2:$B$528,B2,$L$2:$L$528)

It's now working but I don't need the same answer for the same order ID's. 现在可以正常工作,但对于相同的订单ID,我不需要相同的答案。 For example with order #1745. 例如,订购#1745。 I don't need to have the total for on both M3 and M4. 我不需要M3和M4的总数。 If the order has already been totaled, I need it to skip to the next order number. 如果订单已总计,我需要它跳到下一个订单号。

Is there a way to do this? 有没有办法做到这一点?

I found the answer. 我找到了答案。 What I did was search for the string that counts my order as number 1. ie #1745 - 1 then adding the sumif formula to it. 我所做的是搜索将我的订单记为1的字符串。即#1745-1,然后向其中添加sumif公式。

Here's what it looks like: 看起来是这样的:

=IF(ISNUMBER(FIND(" - 1",A2)),SUMIF($B$2:$B$528,B2,$L$2:$L$528),"")

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

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