Only add cells in column when the total of multiple other cells in that row equals 5

喜夏-厌秋 提交于 2019-12-12 01:36:24

问题


So I am getting data fed into a spreadsheet on Google Sheets. I cannot edit that spreadsheet.

I have an additional sheet in the document that totals up the columns in this sheet. The sheet received info such as:

  A  B  C  D        This info is not actually in the sheet
|------------|        \/    \/
| 4  1  0  0 |      <-- Valid
| 3  1  1  0 |      <-- Valid
| 3  1  0  2 |      <-- Invalid
| 3  0  1  1 |      <-- Valid
|------------|

The total of each individual row should be 5, but I do not currently have a way of validating this in the form itself. So I need to disregard or remove the data if it is in violation.

So basically, I want to add all the values of column A together, but only of the rows in which the total of these 4 cells are exactly 5; No more, no less.

The furthest/closest I have gotten was using SUMIF, but the I need a single cell indicating whether or not the row totals up to 5, and as I said before, I cannot edit the cells in that specific sheet.


回答1:


Try this:

=SUMPRODUCT((($A$1:$A$4+$B$1:$B$4+$C$1:$C$4+$D$1:$D$4)=5)*$A$1:$A$4)



来源:https://stackoverflow.com/questions/35991604/only-add-cells-in-column-when-the-total-of-multiple-other-cells-in-that-row-equa

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!