I have a list of numbers in Column B corresponding to different rownumbers in Column A (for example, in B1, I have the list {1,2,3}). I would like to turn this list into a list of cells ({A1,A2,A3}) and apply a formula to that list in Column C (for example, I would like to AND them together).
Column A always contains Boolean Values.
Column B will always contain valid rownumbers separated by a comma.
I would like a formula that I can put in Column C and drag down and extract the numbers from (for example using =SPLIT(B1,",")
) and then apply a formula to.
Shown in the table below is a sample of what I would like to achieve. Note that Column C contains a manual entry approach that I would like to avoid.
| Column A | Column B | Column C | Column D (expected ouput)
| -------- | -------- | -------------- | -----------
Row 1 | TRUE | 1,2,3 | =AND(A1,A2,A3) | FALSE
Row 2 | FALSE | 2,4 | | FALSE
Row 3 | FALSE | 4,6,2,1 | | FALSE
Row 4 | FALSE | 2 | | FALSE
Row 5 | TRUE | 1,5 | | TRUE
Row 6 | FALSE | 1,5,3 | | FALSE
Some things I have tried include using
=INDEX(A:A,SPLIT(B1,","),1)
=AND(ARRAYFORMULA(INDEX(A:A,SPLIT(B1,","),1)))
I have also tried moving around the order of the formulas in the above equation to no avail.
I have only managed to get my formula to be affected by the first rownumber in column B.
You were very close! With BYCOL (considering that the SPLIT result is a serie of cells in columns) you can get the INDEX of column A; and wrap it in AND:
=AND(BYCOL(SPLIT(B1,","),LAMBDA(i,INDEX(A:A,i))
If you want, you can wrap it in BYROW to apply to your whole range:
=BYROW(B:B,LAMBDA(b,IF(b="","",AND(BYCOL(SPLIT(b,","),LAMBDA(i,INDEX(A:A,i)))))))