Search code examples
regexgoogle-sheetsgoogle-sheets-formulaarray-formulasgs-vlookup

Extract a string from long text to be used as a search key


I have a list with many variable product descriptions:

SHeet1

enter image description here

And I need to give a rating for each description. As a parameter for consultation I have only the model that makes up each description, with the respective classification:

Sheet 2

enter image description here

How can I search and sort the descriptions?


Solution

  • try:

    =ARRAYFORMULA(IFNA(VLOOKUP(IFNA(REGEXEXTRACT(A2:A; TEXTJOIN("|"; 1; 
     FILTER(Sheet2!A2:A; Sheet2!A2:A<>"...")))); Sheet2!A2:B; 2; 0)))
    

    0


    FIX:

    =ARRAYFORMULA(IFNA(VLOOKUP(IFNA(REGEXEXTRACT(A2:A; TEXTJOIN("|"; 1; 
     SORT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(FILTER(Sheet2!A2:A; Sheet2!A2:A<>"");
     "+"; "\+"); "("; "\("); ")"; "\)"); 1; 0)))); Sheet2!A2:B; 2; 0)))
    

    enter image description here