简体   繁体   中英

Statement for checking IF multiple cells CONTAIN certain text

I have a column of values, and then I have two columns with simple marking like just an 'X':

     A              B               C
1    
2
3    VALUES:       PERSON1:         PERSON2
4    500           X
5    180                            X
6    100                            X
7    200           X
8    TOTAL:
9    =SUM(A4:A8)   ??               ??

Can I create a statement that will check that if a box has an X in it the value of the A-column cell on the same row will be subtracted from the total summation?

In the example above PERSON2 should have a statement with the values '=980-180-100' which is 700 .

I can easily do it for one cell: =IF(B4="X", A9-A4) but I can't quite get around with doing with multiple.

I suspect:

=SUM(A4:A7)-SUMIF(B4:B7,"X",A4:A7)  

is what you are after, or perhaps:

=SUM(A4:A7)-2*SUMIF(B4:B7,"X",A4:A7)  

but a better solution is from @barry houdini:

in B9 try this formula copied to C9 =SUMIF(B4:B7,"<>X",$A4:$A7)

您可以使用=$A9-SUMIFS($A4:$A7,B4:B7,"X")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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