Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

How search for multiple values in string and return a value depending on the match?

$
0
0

This is my sample data

A...
1This doesn't match...
2This one has Foo...
3In this, Foo exists too...
4Here we have Bar this time...

I have in a different sheet the values to search

A
1Foo
2Bar

This is the result I need

AB...
1This doesn't match< nothing >...
2This one has FooFoo...
3In this, Foo exists tooFoo...
4Here we have Bar this timeBar...

For this example the next formula would work

=IFS(regexmatch(A1, "Foo"), "Foo", regexmatch(A1, "Bar"), "Bar")

but in reality I have to search for values in a range, so can't list every term manually.

How can I solve this?


Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>