What is function to search for a string in an excel cell and have another string displayed in the second cell whether that string was found in the first cell.
For example:
Cell A1 contains text: “This is some sample text”
I have a list of predefined strings in a column in another sheet, and they are: “text, sample1, sample2, string” (all in separate cells)
Cell A2 should then display: text – because the word text exists in cell A1, so basically need to match only specific words from one cell to the other. In real life A1 will have many words but I need to just look for one.
If your list of 4 text strings are in Sheet2!$D$1:$D$4 then try this formula in A2
=LOOKUP(2^15,SEARCH(Sheet2!$D$1:$D$4,A1),Sheet2!$D$1:$D$4)for your example that will return “text”. In general it will return the last matching word from that range
…..you can also modify that slightly to match whole words only
=LOOKUP(2^15,SEARCH(" "&Sheet2!$D$1:$D$4&" "," "&A1&" "),Sheet2!$D$1:$D$4)assumes only spaces between words (no punctuation)