Search code examples
stringif-statementgoogle-sheetsgoogle-sheets-formulamatch

Google sheets, how do I get regexmatch to find a text string in a list?


I am new here, I have tried search for this answer and I can't find the same question

I am a totally self taught spreadsheet-maker, so if I have done some weird stuff - Please don't judge too harshly!

So I am using REGEXMATCH, and it just doesn't seem to be working like it usually does, and I can't work out why.

=IF($A13="","",(IF(REGEXMATCH({$L$13:$L$18},$A13),"YES","NO")))

I have made a workbook example to show the dilemma-

https://docs.google.com/spreadsheets/d/1paNG9Q-AciYbIR3HSgW7vxqNJmJBexgpm2lkLn32PN8/edit?usp=sharing

I want each line to tell me if its CODE-ID is in a list of items. I am pretty sure I had this working at some point, but I can't remember what I have changed. The regexmatch seems to just be picking up whether the code is in the first cell of the list.

Can anyone tell me what I have done wrong? I want the YES/NO column to change as I add new CODE-IDs to the list.

The weird thing is, I have got other cells to work by breaking the code right down to the basic regexmatch formula and building it up again, but it wont replicate when I copy it to another line. I don't know how to show that in this example because it isn't working here.

Let me know if this makes sense,

Thank you kindly,

Ellie


Solution

  • use in I13:

    =INDEX(IF(A13:A="",,IF(ISNUMBER(MATCH(A13:A, L13:L18, 0)), "YES", "NO")))
    

    enter image description here