I'm looking to match a list of keywords in Columns (A, B, C) and categorize(Column D) each link with found strings within the keywords list.
- Match link strings with keywords list for categorization
- If there are 2 keywords for category, both keywords must match in order to categorize
- article word separators will always be "-"
I'm thinking google apps script would be best to categorize it efficiently.
Here's the spreadsheet: https://docs.google.com/spreadsheets/d/1W4VAqUDVdJ6EJqzhkMlYRnUOSSM-kdhj3MfuZsu17qM/edit#gid=0
So far, I have this formula which sort of works sometimes but is slow and inconsistent:
=ARRAYFORMULA(IFERROR(REGEXEXTRACT(
IFERROR(VLOOKUP(INDEX(IFERROR(REGEXEXTRACT(IFERROR(SPLIT(H2:H, "-")),
TEXTJOIN("|", 1, A2:C))),,1), {{A2:A;B2:B;C2:C},{D2:D;D2:D;D2:D}}, 2, 0))&
IFERROR(VLOOKUP(INDEX(IFERROR(REGEXEXTRACT(IFERROR(SPLIT(H2:H, "-")),
TEXTJOIN("|", 1, A2:C))),,2), {{A2:A;B2:B;C2:C},{D2:D;D2:D;D2:D}}, 2, 0))&
IFERROR(VLOOKUP(INDEX(IFERROR(REGEXEXTRACT(IFERROR(SPLIT(H2:H, "-")),
TEXTJOIN("|", 1, A2:C))),,3), {{A2:A;B2:B;C2:C},{D2:D;D2:D;D2:D}}, 2, 0)),
TEXTJOIN("|", 1, UNIQUE(IFERROR({
VLOOKUP(INDEX(IFERROR(REGEXEXTRACT(IFERROR(SPLIT(H2:H, "-")),
TEXTJOIN("|", 1, A2:C))),,1), {{A2:A;B2:B;C2:C},{D2:D;D2:D;D2:D}}, 2, 0);
VLOOKUP(INDEX(IFERROR(REGEXEXTRACT(IFERROR(SPLIT(H2:H, "-")),
TEXTJOIN("|", 1, A2:C))),,2), {{A2:A;B2:B;C2:C},{D2:D;D2:D;D2:D}}, 2, 0);
VLOOKUP(INDEX(IFERROR(REGEXEXTRACT(IFERROR(SPLIT(H2:H, "-")),
TEXTJOIN("|", 1, A2:C))),,3), {{A2:A;B2:B;C2:C},{D2:D;D2:D;D2:D}}, 2, 0)}))))))
How can this be achieved with Google App Scripts? Any help is appreciated, thanks!
