0

We are using Google Sheets to track a list of about 60 people. We add and remove some each week. I am using functions like this to join them into a groups, =TEXTJOIN(", ", TRUE,$A$2:$A$15)

I would like to replace the $A$2:$A$15 part with something that would take 1/5th of the total list regardless of how long or short it becomes. Is this possible?

player0
  • 124,011
  • 12
  • 67
  • 124
John F. Miller
  • 26,961
  • 10
  • 71
  • 121

3 Answers3

1

try:

=TEXTJOIN(", ", 1, INDIRECT("A2:A"&ROW(A2)-1+ROUNDDOWN(COUNTA(A2:A)/5)))

enter image description here

player0
  • 124,011
  • 12
  • 67
  • 124
1

or:

=TEXTJOIN(", ", 1, 
 QUERY(A2:A, "where A is not null limit "&ROUNDDOWN(COUNTA(
 QUERY(A2:A, "where A is not null", 0))/5), 0))

enter image description here

player0
  • 124,011
  • 12
  • 67
  • 124
1

If you want to group only the first fifth:

=TEXTJOIN(", ", TRUE,$A$2:INDEX($A$2:$A,ROUNDUP(COUNTA(A2:A)/5)))

or if you want group all:

=TEXTJOIN(", ", TRUE,FILTER($A:$A,ROW($A:$A)>=(ROUNDUP(COUNTA($A:$A)/5)*(ROW()-2)+2),ROW($A:$A)<=(ROUNDUP(COUNTA($A:$A)/5)*(ROW()-1)+1)))

enter image description here

basic
  • 11,673
  • 2
  • 9
  • 26