In the example below I'd like to enter in cells L4, M4 and N4 a formula that will return all the flavors (range C:C) for a given product (range B:B). For example, in cell L4, the formula should look at the data in L3, goes to B3 (because equals to L4), and returns all non empty cells in the range C4:C9 (row B3 +1 to row B10-1, until it finds another non empty cell in column B or end of the table basically).
Note:
Thanks in advance for your help with this!
I've tried a combination of Index, Small and Rows, but can't find the right formula...
This formula combination may be a little complex, so let me use line break to explain
=FILTER(
OFFSET($B$1,
MATCH(L$3,$B:$B,0),
1,
MATCH(TRUE,NOT(ISBLANK(OFFSET($B$1,MATCH(L$3,$B:$B,0),0,9999,1))),0)-1,
1),
OFFSET($B$1,MATCH(L$3,$B:$B,0),1,MATCH(TRUE,NOT(ISBLANK(OFFSET($B$1,MATCH(L$3,$B:$B,0),0,9999,1))),0),1)<>"")
OFFSET => The formula to get a range with relative postition from a reference field. We take B1 as the reference field
OFFSET have 5 parameters, (reference field, offset row, offset col, range height, range width) Reference field = B1
Take L4 as example
Then we can get the not blank content in C4 : C9
Formula will be like this in one line:
=FILTER(OFFSET($B$1,MATCH(L$3,$B:$B,0),1,MATCH(TRUE,NOT(ISBLANK(OFFSET($B$1,MATCH(L$3,$B:$B,0),0,9999,1))),0)-1,1),OFFSET($B$1,MATCH(L$3,$B:$B,0),1,MATCH(TRUE,NOT(ISBLANK(OFFSET($B$1,MATCH(L$3,$B:$B,0),0,9999,1))),0)-1,1)<>"")
BUT ONE THING TO NOTICE, in the end of product C, need some random text to show there is no more data after the row.