If then using wildcard

ec1957

New Member
Joined
Jul 29, 2008
Messages
31
Have a cell that says something like "123 main street".
I want the cell next to it to = Main if it detects main in the other cell and if not then it should say no. I tried this.

=if(B2="*main","Main","No"

However, it is not working. Any thoughts.
 
I think that's right Peter...I believe if seen this in a CountIf formula.

If there's really only three search values you can get away with a nested set of if's. My attempts at fuzzy matching with three or more search values were not very successful otherwise - but a custom function could be designed to handle more search criteria.

This is an example of the same formula posted above but applied "three times" (however, it does not give two results if the address has two of the searched values -- i.e. main street would return "main"):
book1
BCDE
1
2MainRoadMain
3234PresidenteStreetStreet
4987ForestDriveDrive
5987ForestRoadno
Sheet1


Formula in Cell B3 is:
=IF(ISNUMBER(SEARCH("Main",B2)),"Main",IF(ISNUMBER(SEARCH("Street",B2)),"Street",IF(ISNUMBER(SEARCH("Drive",B2)),"Drive","no")))

HTH, Alex
 
Upvote 0

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
If you have a named range list containing the list of search term, i.e. "Main", "Street" and "Road" then you could use this formula

=LOOKUP(2^15,SEARCH(list,B2),list)
 
Upvote 0
Sorry, I think I'm making it more confusing.

I want to be able to have a cell in column B look into a cell in column A. I want it to attempt to find any one of three different variables. Depending on the variable I have it looking for, the cell in column B would then = X.
Then maybe ...

a) This adaptation of barry's formula?

Excel Workbook
ABCD
1Main
2123 Main StreetXRoad
3234 Presidente RoadXDrive
4987 Forest DriveX
5123 Main RoadX
6234 Smith Street
7123 Mainstream AvenueX
Check Text
#VALUE!
</td></tr></table></td></tr></table>


b) If you didn't want 'X' in the last row of my sample because 'Main' is not the entire word...

Excel Workbook
ABCD
1Main
2123 Main StreetXRoad
3234 Presidente RoadXDrive
4987 Forest DriveX
5123 Main RoadX
6234 Smith Street
7123 Mainstream Avenue
Check Text
#VALUE!
</td></tr></table></td></tr></table>
 
Upvote 0

Forum statistics

Threads
1,216,086
Messages
6,128,736
Members
449,466
Latest member
Peter Juhnke

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