IF and Wildcards

longstick

New Member
Joined
Nov 19, 2011
Messages
42
I've done lots of searching online and on this board and I am still unable to get the solutions that I've found to do what I want them to do.

I need a statement that will compare two cells and see if they match. However, one of the cells will contain the "Maker" and the "Model Number". The second cell will only contain the "Model Number".

Lets use A1 and B1.

A1 will have "Test 123"
B1 will have "123"

I would like the final result of the formula to say True because A1 does contain B1. I need to only use Cell references.

I've tried something like this but I can't seem to figure it out. I've used 1 and 0 to make it simple until I've figured it out.
Code:
=if(A1="*"&B1&"*",1,0)
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
I think that's what I want. thanks!

Can you break it down and quickly explain why it does what it does?
 
Upvote 0
FIND looks for cell B1 anywhere in A1. (Marcelo suggested using SEARCH, the difference is that SEARCH is NOT case-sensitive; i.e. it will find Abc in 123aBc, etc.). If it finds the entire B1 anywhere in A1, it will return the character number of the starting point. So 123 in ABC123 would return 4. If it doesn't find it, it will evaluate to an error.

ISNUMBER checks whether an expression evaluates to a number and returns either TRUE or FALSE.

So on second thought, you could trim it down to =ISNUMBER(FIND(B1,A1)) and return either TRUE or FALSE; which 1 and 0 are the Boolean equivalents of, respectively.
 
Upvote 0
=if(isnumber(find(b1,a1)),1,0)

Maybe,

=IF(ISNUMBER(SEARCH(B1,A1)),1,0)

M.

I've done lots of searching online and on this board and I am still unable to get the solutions that I've found to do what I want them to do.

I need a statement that will compare two cells and see if they match. However, one of the cells will contain the "Maker" and the "Model Number". The second cell will only contain the "Model Number".

Lets use A1 and B1.

A1 will have "Test 123"
B1 will have "123"

I would like the final result of the formula to say True because A1 does contain B1. I need to only use Cell references.

I've tried something like this but I can't seem to figure it out. I've used 1 and 0 to make it simple until I've figured it out.

=if(A1="*"&B1&"*",1,0)
One way:

=COUNT(SEARCH(B1,A1))
 
Upvote 0
Ok. I've been able to get a simple version work. Now this is the formula that I'd like to have work is.

Code:
=IF(ISNUMBER(SEARCH(INDEX('[TOOL_TRACK.xls]TOOLS NORTH'!$E:$F,MATCH(F35,'[TOOL_TRACK.xls]TOOLS NORTH'!$F:$F,0),1),E69,)),"OK","NG")

URYU UL-130MC (Cell "E69")
UL-130MC (Index Formula)

I am receiving an error in the search part of the code. Index brings up "UL-130MC" with no issues. When the search compares the the two I receive "#Value!" which in turns give me "NG".
 
Upvote 0
Try

=IF(ISNUMBER(SEARCH(E69,INDEX('[TOOL_TRACK.xls]TOOLS NORTH'!$E:$F,MATCH(F35,'[TOOL_TRACK.xls]TOOLS NORTH'!$F:$F,0),1))),"OK","NG")
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,632
Latest member
jladair

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