Search code examples
google-sheetsgoogle-sheets-formula

Column of Names Spread Out to 6 Columns


I have a Google Sheet with a list of names in Column A. Is there a formula to distribute these names equally across 6 columns? I currently have 80 names, and I know this won't divide the names equally between the 6 columns. But, could it be set up to where it will distribute the names equally until the last column, which will have more names in it because it doesn't divide equally?

Thanks for your help.


Solution

  • You may try:

    =let(Σ,tocol(A2:A,1),
         Λ,wrapcols(Σ,quotient(counta(Σ),6),),
         Γ,choosecols(Λ,7),
         {choosecols(Λ,sequence(6));{makearray(counta(Γ),5,lambda(r,c,iferror(1/0))),iferror(chooserows(Γ,sequence(counta(Γ))))}})
    

    enter image description here

    Updated answer:

    =let(Σ,tocol(A2:A,1),
         cols,6,
         Λ,wrapcols(Σ,round(counta(Σ)/cols),),
         Γ,choosecols(Λ,cols+1),
         {choosecols(Λ,sequence(cols));{makearray(counta(Γ),cols-1,lambda(r,c,iferror(1/0))),iferror(chooserows(Γ,sequence(counta(Γ))))}})