Please help me turn an ugly function into a beautiful array

Joined
May 6, 2011
Messages
25
I've got a nested function that works just fine, but it's long, ugly, and hard to expand:

=IF(OR(ISNUMBER(SEARCH(E$3,$A2)),ISNUMBER(SEARCH(E$4,$A2)),ISNUMBER(SEARCH(E$5,$A2)),ISNUMBER(SEARCH(E$6,$A2))),E$2,"")

In other words, if any of the strings I've entered in cells E3 through E6 are found in cell A2, then the contents of E2 are returned in the active cell.

Like I said, this works fine, but it gets ever longer and more unwieldy the more search terms I add.

I know that the answer is an array. How would I go about transforming this into one?
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Here are my results so far. The arrays from shg and T. Valko work like a charm, but njimack's array still isn't working for me, and neither is JoeMo's non-array function.

I was putting together a screenshot showing myself using njimack's array and it not working; however, it looks like the conversation has progressed in the meantime. Thank you, T. Valko and Aladin.

As for your function, Joe, what I was looking for is whether the strings in E3:E6 appear anywhere in A2, rather than the reverse.

Thank you all again for your help! This is a great board.
 
Upvote 0
Here are my results so far. The arrays from shg and T. Valko work like a charm, but njimack's array still isn't working for me, and neither is JoeMo's non-array function.

I was putting together a screenshot showing myself using njimack's array and it not working; however, it looks like the conversation has progressed in the meantime. Thank you, T. Valko and Aladin.

As for your function, Joe, what I was looking for is whether the strings in E3:E6 appear anywhere in A2, rather than the reverse.

Thank you all again for your help! This is a great board.
You're welcome. Thanks for the feedback! :cool:
 
Upvote 0

Forum statistics

Threads
1,224,542
Messages
6,179,424
Members
452,914
Latest member
echoix

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