I have a large O365 Excel spreadsheet. Sheet 1 contains multiple rows with comma separated values, together with some descriptive text, in the format:
| A | B
------------------------------------------
1| ID-A-01,ID-A-02,ID-C-02 | lion
------------------------------------------
2| ID-A-02,ID-A-03,ID-B-01 | monkey
------------------------------------------
3| ID-A-01,ID-B03,ID-C02 | dolphin
------------------------------------------
[etc]
Sheet 2 contains a report in the format:
| A | B
-----------------------------|-----------
1| ID-A-01 |
-----------------------------| lion
2| ID-A-02 | monkey
-----------------------------| dolphin
3| ID-A-03 |
------------------------------------------
4| ID-B-01 |
------------------------------
5| ID-B-02 | monkey
------------------------------ dolphin
6| ID-B-03 |
------------------------------------------
7 | ID-C-01 | lion
------------------------------ dolphin
8 | ID-C-02 |
-------------------------------------------
[etc]
The problem is Sheet 2, Column B. These are merged cells. I'm trying to automatically populate them by comparing the relevant ranges in Sheet 2, Column A (A1:A3,A4:A6,A7:A8, etc) with each of comma separated lists in Sheet 1, Row A, and then executing a textjoin on Sheet 1, Column B for each match that's found.
I can achieve this for single cells on Sheet 2 with:
=IFERROR(TEXTJOIN(CHAR(10),TRUE,FILTER(Sheet1!B1:B3,ISNUMBER(SEARCH(Sheet2!A1,Sheet1:A1:A3)))),"")
This would correctly return 'lion/dolphin' for the value 'ID-A-01' and 'lion/monkey' for 'ID-A-02', etc. But I can't get it work when I used a range of lookup values.
I've seen some posts online that indicate XML filters might work, perhaps by converting the ranges in Sheet 1, Column A into comma separated lists too, but I'm not familiar enough with Excel's XML functions to know how to make that approach work.
Does anyone have a neat solution that doesn't involve a mess of nested textjoins and filters? (I'm going to need to use this formula for hundreds of cells so it needs to be easily repeatable and modifiable) Appreciate Excel is not really designed to do this, and I'd have solved it easily with PHP/MySQL, but unfortunately Excel is the only option available.