SUMPRODUCT and Wild Characters

FalconFlyer

New Member
Joined
May 18, 2015
Messages
30
I am trying to use SUMPRODUCT to find any cells that contain "ok". The cells may contain "ok, Last Item" or "ok", all of which I want counted. My formula is:

=(SUMPRODUCT(($K$2:$K$345="ok")*($M$2:$M$345="duplicate")))

The above will not include "ok, last item", but it does accurately count "ok".

=(SUMPRODUCT(($K$2:$K$345="ok*")*($M$2:$M$345="duplicate"))) - Added "*"
Calculates 0, even though there are 5 matching cells with "ok" and "ok, Last Item".

How do I fix this formula to make it work for both scenarios? Do I just have to break it into 2 separate formulas?

Thank you in advance.
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
maybe

=(SUMPRODUCT((LEFT($K$2:$K$345,2)="ok")*($M$2:$M$345="duplicate")))
 
Upvote 0
Hi FalconFlyer,

How about simply using:
=COUNTIF(A:A,"ok*")
 
Upvote 0
Try:

=(SUMPRODUCT(--ISNUMBER(SEARCH("ok",$K$2:$K$345)),--($M$2:$M$345="duplicate")))

wildcards don't work in SUMPRODUCT, although you can get around that using SEARCH.
 
Upvote 0
Thank you all for your help.

BarryL, Eric W, and Weazel - All of your suggestions got the job done. Thank you.

JustynaMA - Unfortunately, I have to also have the "duplicates" comparison in the formula.
 
Upvote 0

Forum statistics

Threads
1,214,626
Messages
6,120,602
Members
448,974
Latest member
ChristineC

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top