I want to identify if particular text can be found in a cell in Google Spreadsheets like this example:
Text | Desired Output |
---|---|
Cynthia and Dale went to the store | Cynthia, Dale |
Cynthia went to the store | Cynthia |
Unfortunately using this code
IF(REGEXMATCH(A2,"Bob"),"Bob",IF(REGEXMATCH(A2,"Cynthia"),"Cynthia",IF(REGEXMATCH(A2,"Dale"),"Dale","Nobody")))
Only returns the first REGEX match found, not multiple ones as I would like.
Any suggestions for modifying the formula would be helpful.
A spreadsheet can be found with the examples and code here: https://docs.google.com/spreadsheets/d/1YuyFdEbqgZaSL2IbyyalVLLXsXrIAuqtaxCTXLhSuEU/edit?usp=sharing
Thanks in adavance.