Iterate through field for '!' string, then iterate through another field to collect cells that had '!' in their records, in an array

Hi everyone,

I have some coding experience, although by knowledge of Javascript is still very limited.
What I’m essentially trying to do is:

  1. Iterate through one field for a certain string
  2. Collect name (or ID I suppose) of the record that had the string in an array

The point of doing this would be to be able to compile the names of all the records that had the targeted string into a list that I could then email out through a build in automation. Unfortunately Airtable makes it difficult to send multiple records on a single automation, so I was wondering if I could do it this way. Thanks.