Sam
Sam

Reputation: 315

Why does my wildcard search with SUMIF not work?

In MS Excel, I'm trying to make a wildcard search using the SUMIF function. I'm following this guide. However, for some reason my Excel doesn't think the words in the range are equal to the criterion.

Suppose I have the following data: The data in A2:B6 I have apple as a criterion and want to find sum all the cells adjacent to one containing the word apple. My formula is: =sumif(A2:A6, "*apple*", B2:B6)

Now, for some reason the result of the sum function amounts to nothing.

I also tried another test, which I think my error has to do with. If I type = "apple" = "*apple*", Excel returns False`. The two are related, I think, but I don't see how I can solve my original problem.

Any help is much appreciated.

Upvotes: 0

Views: 882

Answers (1)

Solar Mike
Solar Mike

Reputation: 8415

Try

=sumif(b2:b6,"*apple*",a2:a6)

As according to your example you have the sum range first followed by the range you are controlling against.

That is the wrong way round for sumif().

Upvotes: 1

Related Questions