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

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
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,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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