1

I have a working Index, Match, Search formula that searches the titles of my products for specific terms that I've determined in a Key, if no result is found then alternatively it searches my product SKU's using a different key.

Currently, the formula is only giving me the first result that it finds within my key but I would like it to return as many results as possible all separated by Pipes or commas.

Here's the working formula that is giving me 1 result.

=IF((ARRAYFORMULA(INDEX('Array Key'!$J:$J,MATCH(TRUE,ISNUMBER(SEARCH('Array Key'!$I:$I,$B2)),0))))="",(ARRAYFORMULA(INDEX('Array Key'!$L:$L,MATCH(TRUE,ISNUMBER(SEARCH('Array Key'!$K:$K,$A2)),0)))),(ARRAYFORMULA(INDEX('Array Key'!$J:$J,MATCH(TRUE,ISNUMBER(SEARCH('Array Key'!$I:$I,$B2)),0)))))

This would be awesome if I could get it working. Here's a link to a copy of my spreadsheet if anyone would like to see it working. Feel free to make any edits.

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

I've tried to use the following formula but it doesn't quite work how I'd like it to.

=IF((ARRAYFORMULA(INDEX('Array Key'!$F:$F,MATCH(TRUE,ISNUMBER(SEARCH('Array Key'!$E:$E,$B2)),0))))="",(ARRAYFORMULA(INDEX('Array Key'!$H:$H,MATCH(TRUE,ISNUMBER(SEARCH('Array Key'!$G:$G,$A2)),0)))),(ARRAYFORMULA(INDEX('Array Key'!$F:$F,MATCH(TRUE,ISNUMBER(SEARCH('Array Key'!$E:$E,$B2)),0)))))&" | "&(ARRAYFORMULA(INDEX('Array Key'!$H:$H,MATCH(TRUE,ISNUMBER(SEARCH('Array Key'!$G:$G,$A2)),0))))

This formula searches the 2nd key again and concatenates any results. However, I'm getting duplicates and it still only returns the first result found.

8
  • You should look into TEXTJOIN() function :)
    – JvdV
    Jul 10, 2019 at 12:59
  • I've had a little look into I just have no idea how to apply it to my formula :(
    – Maladorf
    Jul 10, 2019 at 13:35
  • Is there any reason why you tagged Excel at all, cause right now another user removed it from the question. If it has no relevance you should leave it out.
    – JvdV
    Jul 10, 2019 at 13:38
  • what should be the desired output of D2 cell??
    – player0
    Jul 10, 2019 at 13:41
  • 1
    The desired output for cell D2 would be War | Horror as in the Array Key tab in cells E25 and cell E41 death has 2 categories that I would like to assign in cell D2
    – Maladorf
    Jul 10, 2019 at 13:46

1 Answer 1

0

if this would be like:

enter image description here


then D2 cell would be:

=ARRAYFORMULA(TEXTJOIN(" | ", 1, UNIQUE({
 IFERROR(VLOOKUP(TRANSPOSE(IFERROR(REGEXEXTRACT(SPLIT(B2, " "), 
 TEXTJOIN("|", 1, 'Array Key'!E$3:E)))), 'Array Key'!E$3:F, 2, 0));
 IFERROR(VLOOKUP(TRANSPOSE(IFERROR(REGEXEXTRACT(SPLIT(A2, " "), 
 TEXTJOIN("|", 1, 'Array Key'!G$3:G)))), 'Array Key'!G$3:H, 2, 0))})))

0

3
  • 1
    That's brilliant. That works exactly like I wanted it to. Thanks a lot for your help!
    – Maladorf
    Jul 11, 2019 at 9:08
  • Hi, I've just picked this project up again after a little break and I was wondering if you could possibly help? Here's a link to the sheet that I'm working on docs.google.com/spreadsheets/d/… I can't quite figure out why I'm getting some results. For example, the "Star Wars" products I've highlighted in dark grey aren't being assigned a theme, even though the word "Star Wars" exists in the title (As you can see in the Array Key tab on row 103 "Star Wars" exists there)
    – Maladorf
    Aug 8, 2019 at 14:16
  • check your sheet now
    – player0
    Aug 8, 2019 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.