Can this formula be simplified?

rastak

New Member
Joined
Dec 16, 2012
Messages
7
=IF(OR(ISNUMBER(SEARCH("*tul1*",N4)),ISNUMBER(SEARCH("*sk701*",N4)),ISNUMBER(SEARCH("*cv901*",N4)),ISNUMBER(SEARCH("*cv911*",N4)),ISNUMBER(SEARCH("*ts901*",N4)),ISNUMBER(SEARCH("*461*",N4)),
ISNUMBER(SEARCH("*462*",N4)),ISNUMBER(SEARCH("*463*",N4)),ISNUMBER(SEARCH("*465*",N4)),ISNUMBER(SEARCH("*466*",N4))),"IL1",
IF(OR(ISNUMBER(SEARCH("*tul2*",N4)),ISNUMBER(SEARCH("*ts902*",N4)),ISNUMBER(SEARCH("*cv903*",N4)),ISNUMBER(SEARCH("*cv905*",N4)),ISNUMBER(SEARCH("*cv912*",N4)),ISNUMBER(SEARCH("*ILCV-ts905*",N4)),
ISNUMBER(SEARCH("*661*",N4)),ISNUMBER(SEARCH("*663*",N4)),ISNUMBER(SEARCH("*667*",N4)),ISNUMBER(SEARCH("*sk702*",N4))),"IL2",
IF(OR(ISNUMBER(SEARCH("*tul3*",N4)),ISNUMBER(SEARCH("*ts908*",N4)),ISNUMBER(SEARCH("*cv908*",N4)),ISNUMBER(SEARCH("*cv906*",N4)),ISNUMBER(SEARCH("*cv916*",N4)),ISNUMBER(SEARCH("*ILCV-ts906*",N4)),
ISNUMBER(SEARCH("*561*",N4)),ISNUMBER(SEARCH("*563*",N4)),ISNUMBER(SEARCH("*567*",N4)),ISNUMBER(SEARCH("*562*",N4)),ISNUMBER(SEARCH("*sk704*",N4))),"IL3","check it")))
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Try this,

=IF(OR(ISNUMBER(SEARCH({"tul1","sk701","cv901","cv911","ts901",461,462,463,465,466},N4))),"IL1",IF(OR(ISNUMBER(SEARCH({"tul2","ts902","cv903","cv905","cv912","ILCV-ts905",661,663,667,"sk702"},N4))),"IL2",IF(OR(ISNUMBER(SEARCH({"tul3","ts908","cv908","cv906","cv916","ILCV-ts906",561,563,567,562,"sk704"},N4))),"IL3","check it")))
 
Upvote 0
You don't need the asterisks in your search strings. The asterisk stands for zero or more characters when used as a wildcard in a search term.

I did come up with an array formula that might be easier to read. You can try this.


Book1
MN
4IL2bbbtul2aaa
5IL1bbb462aaa
6IL3bbbcv906aaa
7check itxxx
Sheet1
Cell Formulas
RangeFormula
M4{=IF(SUM(IFERROR(SEARCH({"tul1","sk701","cv901","cv911","ts901","461","462","463","465","466"},N4),0)),"IL1", IF(SUM(IFERROR(SEARCH({"tul2","ts902","cv903","cv905","cv912","ILCV-ts905","661","663","667","sk702"},N4),0)),"IL2", IF(SUM(IFERROR(SEARCH({"tul3","ts908","cv908","cv906","cv916","ILCV-ts906","561","563","567","562","sk704"},N4),0)), "IL3","check it")))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
or this

=IF(ISNUMBER(MATCH(1,INDEX(SEARCH({"*tul1*","*sk701*","*cv901*","*cv911*","*ts901*","*461*","*462*","*463*","*465*","*466*"},N4),),)),"IL1",IF(ISNUMBER(MATCH(1,INDEX(SEARCH({"*tul2*","*ts902*","*cv903*","*cv905*","*cv912*","*ILCV-ts905*","*661*","*663*","*667*","*sk702*"},N4),),)),"IL2", IF(ISNUMBER(MATCH(1,INDEX(SEARCH({"*tul3*","*ts908*","*cv908*","*cv906*","*cv916*","*ILCV-ts906*","*561*","*563*","*567*","*562*","*sk704*"},N4),),)),"IL3","check it")))
 
Upvote 0
Try this,

=IF(OR(ISNUMBER(SEARCH({"tul1","sk701","cv901","cv911","ts901",461,462,463,465,466},N4))),"IL1",IF(OR(ISNUMBER(SEARCH({"tul2","ts902","cv903","cv905","cv912","ILCV-ts905",661,663,667,"sk702"},N4))),"IL2",IF(OR(ISNUMBER(SEARCH({"tul3","ts908","cv908","cv906","cv916","ILCV-ts906",561,563,567,562,"sk704"},N4))),"IL3","check it")))


this works great!
 
Upvote 0

Forum statistics

Threads
1,216,210
Messages
6,129,525
Members
449,515
Latest member
lukaderanged

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