Sumproduct (ISNUMBER(SEARCH - Multiple criteria

Dtex20

Board Regular
Joined
Jan 29, 2018
Messages
50
Hi guys,

I've stumbled into a problem I've got this formula:

Code:
=SUMPRODUCT(((*Sheetname*$I:$I=$A37)*(*Sheetname*$H:$H>=$A$93)*(*Sheetname*$H:$H<=$A$94)*(ISNUMBER(SEARCH(HD$2,*Sheetname*$N:$N))))

I'm creating a countIFs, but I've hit a wall in my knowledge.. the only problem i have with the formula is the ISNUMBER(SEARCH part, for simplicity purposes i'll use the word "hello" that is stored in cell "HD$2".

So there are 4 ways "hello" can appear in Range ("N:N"). I want to countIF the following three ways:

,hello
hello,
hello

The fourth way "hello" can appear is:

?hello

"?" is 1 random character that character is always a letter (i want to avoid counting these):

ghello
phello
thello

I want to try do this with cell references, in one formula. Is this possible?

Thanks,
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Could you provide an example. say ~10 rows along with expected result?

M.

I'm not quite sure what you mean, but i think you mean this:

A1:A10:

A1: ,hello hello hello hello, - Return 4
A2: ghello ,hello hello - Return 2
A3: phello ghello thello - Return 0
A4: hello hello hello - Return 3
A5: ,hello ,hello hello, - Return 3
A6: hello, hello, phello - Return 2
etc..

Lets say on the other sheet you had something like this in N10:

,hello,ghello - you would return a count of 1.

What is in column N is a list of strings separated by a comma, but it can be broken down into a solution that if it only counts:

,hello
hello,
hello

Each row in column N will only have 1 of those variations, so for example SEARCH(","&ND4 - will return the correct (1) result for any row that says.

bla,bla,bla,hello,bla,bla

i hope that makes sense?

Thanks,
 
Last edited:
Upvote 0
Maybe something like this


A
B
1
hello hello hello hello,​
4​
2
ghello ,hello hello​
2​
3
phello ghello thello​
0​
4
hello hello hello​
3​
5
hello ,hello hello,​
3​
6
hello, hello, phello​
2​

Formula in B1 copied down
=(LEN(","&SUBSTITUTE(SUBSTITUTE(A1,",","")," ",",,")&",")-LEN(SUBSTITUTE(","&SUBSTITUTE(SUBSTITUTE(A1,",","")," ",",,")&",",","&"hello"&",","")))/LEN(","&"hello"&",")

Hope this helps

M.
 
Upvote 0
Or…………

In B1, copied down :

=(LEN(SUBSTITUTE(SUBSTITUTE(" "&A1,",",)," ","@"))-LEN(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(" "&A1,",",)," ","@"),"@hello",)))/LEN("@hello")

Regards
Bosco
 
Upvote 0
Maybe something like this


A
B
1
hello hello hello hello,​
4​
2
ghello ,hello hello​
2​
3
phello ghello thello​
0​
4
hello hello hello​
3​
5
hello ,hello hello,​
3​
6
hello, hello, phello​
2​

<tbody>
</tbody>


Formula in B1 copied down
=(LEN(","&SUBSTITUTE(SUBSTITUTE(A1,",","")," ",",,")&",")-LEN(SUBSTITUTE(","&SUBSTITUTE(SUBSTITUTE(A1,",","")," ",",,")&",",","&"hello"&",","")))/LEN(","&"hello"&",")

Hope this helps

M.

Hi,

My apologies, i gave you an AWFUL example. Let me try explain better...

Code:
[COLOR=#574123]=SUMPRODUCT(((*Sheetname*$I:$I=$A37)*(*Sheetname*$H:$H>=$A$93)*(*Sheetname*$H:$H<=$A$94)*(ISNUMBER(SEARCH(HD$2,*Sheetname*$N:$N))))[/COLOR]


  • On Another sheet in each row of column ("N:N") is a list of words separated by a comma.



  • On my current sheet on Row 2 is the word i'm trying to count. Which is why i'm using (ISNUMBER(SEARCH(HD$2,*Sheetname*$N:$N). The Word in HD$2 is "Tool".



  • The problem is the word "Tool" could appear in the middle of a word for example "GRTool" Which counts as 1 because it still says "Tool".


PL Tool,GRTool,Tool - would count as three, but really Tool appears once.
PL Tool,Tool,GRTool - would count as Three, but really Tool appears once.

The problem is when the word i'm searching for appears in the middle of a word.

I'm basically looking for a way that says in between the comma's separating the words, is there anything else beside the exact string in the cell I've referenced. If there is don't count it.

Sorry for wasting your time.

Thanks.
 
Upvote 0
@ Dtex20

You say:

PL Tool,GRTool,Tool- would count as three, but really Tool appears once.

PL Tool,Tool,GRTool - would count as Three, but really Tool appears once.


Why not clearly say whether the desired count is 3 or 1 for each row of data?
 
Last edited:
Upvote 0
@ Dtex20

You say:

PL Tool,GRTool,Tool- would count as three, but really Tool appears once.

PL Tool,Tool,GRTool - would count as Three, but really Tool appears once.


Why not clearly say whether the desired count is 3 or 1 for each row of data?

Hi,

Because it is completely dynamic, the row could contain 10 different strings. Or It could contain two "Tool,Tool" which would be two.

And i have to do this for about 10,000 Rows.

Thanks
 
Upvote 0

Forum statistics

Threads
1,215,580
Messages
6,125,654
Members
449,245
Latest member
PatrickL

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