I have a list of patients ordered by date (or manually insert to the end of the column): https://docs.google.com/spreadsheets/d/1tJL6RVP55KYvno6cdD-qOmmR3tW4FAsb2WnW-684FR0/edit?usp=sharing
I have a list of doctors with 4 doctors (or more, just for example). Now I need to fill those patients on this list with the rule: each patient will be assigned to 1 doctor time by time.
Ex:
Please help. Here is the demo of what I need: https://docs.google.com/spreadsheets/d/1GH-XvsgLvVv5y4Q2irEgA6Vvblquz8KbwVlq_dErwDQ/edit#gid=0
something more advanced:
=INDEX(IFERROR(VLOOKUP(SUBSTITUTE(D2:D, " ", CHAR(13)),
SPLIT(FLATTEN(TRIM(QUERY(REGEXREPLACE(SUBSTITUTE(QUERY({
FILTER(TEXT(ROW(A2:A), "000000")&"×"&A2:A, A2:A<>""), ARRAY_CONSTRAIN(FLATTEN(TRANSPOSE(
FILTER(TEXT(ROW(D2:D), "000000")&"×"&D2:D, D2:D<>"")&T(SEQUENCE(1,
ROUNDUP(COUNTA(A2:A)/COUNTA(D2:D)))))), COUNTA(A2:A), 2)},
"select max(Col1) group by Col1 pivot Col2"), " ", CHAR(13)),
"^(\d+×)", ),,9^9))), " "), SEQUENCE(1, ROUNDUP(COUNTA(A2:A)/COUNTA(D2:D)), 2), 0)))