My goal is to return data in col P randomly from col N
or from col O
.
If cell B3
contains "2 shifts"
, it should return from col N
and if cell B3
contains "3 shifts"
, it should return from col O
.
The amount of random cells to be returned is in D3
and should be able to be changed as wanted. I can extract cells in order by using the below.
=ArrayFormula(QUERY({N2:N, RANDARRAY(ROWS(N2:N))}, "SELECT Col1 LIMIT "&$D3))
The above only returns the first 6 but only contains 1 criteria. I cannot make it work. Please help PS: I can only use formulas and not scripts.
Try:
=LET(
arr, TOCOL({IF(B3 = "2 shifts", N2:N, O2:O)}, 1),
SORTN(arr, D3, , RANDARRAY(ROWS(arr)), )
)