Seems like this should be simple but I'm having a hard time figuring it out.

I have data like this:

      A       B
1   Cr foo   1.00
2   Cr bar   2.00
3   Cr boo   0.50
4   Cr far   3.00

I want to sum column B where column A starts with "Cr". Obviously in the real data there are lots of other values in column A as well that do not start with "Cr".

I've been playing with using left() inside of the sumif, but I can't get it to work.


That would be

=sumif(A1:A, "Cr*", B1:B)

where A1:A is the range to which the condition is applied, Cr* is a pattern that matches any string beginning with Cr (here * stands for any number of any characters), and B1:B is the range of the values to be added.

One can also use query or filter for such operations. I wrote a summary of available functions: String matching in Google Sheets/Docs/Apps Script.

  • Oh for crying out loud... in my research I came across comments stating that wildcards were not supported in this scenario. Maybe it was outdated info, I didn't consider the age. Thank you, this works perfectly! – JVC Jul 15 '17 at 21:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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