SOLVED

Using SUMIF to exclude values

Copper Contributor

Hi Guys,

 

I would like to use SUMIF, if possible, to add up a column but to exclude values when a corresponding cell contains the text "In Flight Relief". Can anybody help?

10 Replies
if you are adding a column use =SUM(range)
this will sum only the numbers excluding strings or text cell..
HTH

Thanks for your response Lorenzo.

 

I think my query may have been unclear. If the column I want to sum is M I would like the function to SUM, but exclude values within column M when there is specific text in a corresponding cell (let’s say column Z).

 

I know how use SUMIF to exclude the values when the corresponding cell has any unspecified text  but I would like to exclude those cell with specific text. 

 

Thanks again. 

I prepared a sample -

see if you can work something out of it.

thanks..

 

press ALT F11 to see the code - you can change any variables to suit..

I think I solved your sumif - pls see attached file

thanks..

=SUMIF(Z2:Z10,"<>In flight Relief",M2:M10)
change the range & text to suit...
best response confirmed by Bradley Peters (Copper Contributor)
Solution
can also reference a cell (Z2):
=SUMIF(Z2:Z10,"<>"&Z2,M2:M10)
where Z2 is the controlling text.
be sure that the text is consistent in all controlling cells - otherwise it won't function properly.
"In Flight Relief" is not sames as "In Flight Relief" nor "Inflightrelief"..
If Z2 is deleted then the sum will be zero.... because the controlling cell is now blank.
HTH

Thank you very much Lorenzo.

 

This formula worked for me.

 

 

glad to help..

@Lorenzo Kim thanks, thats very helpful.

How about if instead of excluding I want to only include field. 

So base on the example I will be only including the "In flight Relief" in my sum calculation.

 

Maria

 

1 best response

Accepted Solutions
best response confirmed by Bradley Peters (Copper Contributor)
Solution
can also reference a cell (Z2):
=SUMIF(Z2:Z10,"<>"&Z2,M2:M10)
where Z2 is the controlling text.
be sure that the text is consistent in all controlling cells - otherwise it won't function properly.
"In Flight Relief" is not sames as "In Flight Relief" nor "Inflightrelief"..
If Z2 is deleted then the sum will be zero.... because the controlling cell is now blank.
HTH

View solution in original post