Search code examples
regexgoogle-sheetssplitduplicatestextjoin

Duplicates in string - google sheets


I have a cell, (coming from an extracted DB) in Google sheets looking like this:

MOMO EL COCO LISTO EL SAFWAN MOMO EL COCO LISTO EL SAFWAN (Mister)

I tried with SPLIT, etc function to get the non duplicate entry:

  • Remove the (Mister) at the end: =index(split(B2,"("),1)
  • Get the valid part of the name (non duplicate) which should be

    MOMO EL COCO LISTO EL SAFWAN

I have not found a way to do this. Any idea how to proceed?


Solution

  • try:

    =TEXTJOIN(" ", 1, UNIQUE(TRANSPOSE(SPLIT(REGEXEXTRACT(A1, "(.+)\("), " "))))
    

    0