Complicated if formula with searching text

currybai

Board Regular
Joined
Jul 14, 2008
Messages
202
I have the following formula

=IF(ISNUMBER(SEARCH("verizon",A2)),"verizon",IF(ISNUMBER(SEARCH("sprint",A2)),"sprint",IF(ISNUMBER(SEARCH("tmobile",A2)),"tmobile","")))


Instead of searching the entire text of A2, is there a way to say search first 5 letters because some text strings look like Verizon-Users-Sprint-Profile but that should really be verizon. And the format is not always text-text-, sometimes its text text or text : text so it varies.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Maybe...

=INDEX({"verizon","sprint","tmobile"},MATCH(LEFT(A2,5)&"*",{"verizon","sprint","tmobile"},0))
 
Upvote 0
Given the structure of the original formula indicates that a null string is to be returned if A2 doesn't start with any of the 3 words, and assuming Excel 2007+, then maybe this modification of Domenic's formula.

=IFERROR(INDEX({"verizon","sprint","tmobile"},MATCH(LEFT(A2,5)&"*",{"verizon","sprint","tmobile"},0)),"")
 
Upvote 0
Given the structure of the original formula indicates that a null string is to be returned if A2 doesn't start with any of the 3 words, and assuming Excel 2007+, then maybe this modification of Domenic's formula.

=IFERROR(INDEX({"verizon","sprint","tmobile"},MATCH(LEFT(A2,5)&"*",{"verizon","sprint","tmobile"},0)),"")


This works perfect. But now for everything else that is not in those 3 words, how do I say take the first word after Client Data. Ex:
Client Data - Nextel (Phone)
Client Data - Bob (Phone)
Client Data - Akame (Phone)

I want the Nextel, Bob, and Akame part.

Then if not those, then how do I layer in just take the first word or few words before a space and parenthesis.

Ex:

Microsoft (software)
Google (internet)
Yahoo.com Portal (Internet

So I want, microsoft, google, and yahoo.com portal.
 
Last edited:
Upvote 0
If the following does not satisfy your requirements, could you give a set of sample data (say 10-15 rows) that demonstrates the whole variety of data you have and also give the expected results for each of those rows?

Excel Workbook
AB
2Verizon-Users-Sprint-Profileverizon
3Client Data - Nextel (Phone)Nextel
4Client Data - Bob (Phone)Bob
5Google (internet)Google
6Yahoo.com Portal (Internet)Yahoo.com Portal
Search text
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

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