I need to sum specific cells in 1 column (Q) based on if the other columns (R, S) have a certain word(s) within the cell.

For example in the picture if a cell in R or S contains the word toy or green, then it needs to sum the specified data from column Q.

I have tried using different variations of sumif-filter-regexmatch but I still can not get it to work with multiple conditions. If there is another set of formulas to use please show me.

Thank you!

P.S (I need the sum from the Q column not the count of cells)

Use this for reference

  • Welcome. Please remember that as per site guidelines when an answer addresses your question, you should accept it so others can benefit as well. Jan 24, 2020 at 21:26

1 Answer 1


You can use the following query formula:

=QUERY(Q2:S11, "select sum(Q) where R matches '(.*green.*)|(.*toy.*)' 
                                 OR S matches '(.*green.*)|(.*toy.*)' label sum(Q)''")

sum query matches multiple words in multiple columns regex


  • Thank you, that seems to work very well! Much appreciated!
    – Lina
    Jan 27, 2020 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.