> For the complete documentation index, see [llms.txt](https://gitbook.testingwaters.in/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.testingwaters.in/lists/divide-equally.md).

# Divide Equally

![](/files/-LhLKme_1zK2x2j5gNwy)

{% file src="/files/-LhLKunIlvSgMWsRnlCy" %}

```d
//Sorting into three lists
nSrt=List.Reverse(List.Sort(n));
nSbL=List.Chop(nSrt,3);
lst1=List.Transpose(List.TakeEveryNthItem(nSbL,2,-1));
lst2=List.Transpose(List.Reverse((List.TakeEveryNthItem(nSbL,2,0))<1>));

//Three sublists with the sum of numbers more or less the same
lst3=(List.Transpose([List.Shuffle(lst1<1>),List.Shuffle(lst2<1>)]));
lst4 = List.Flatten(List.Clean(lst3,false)<1>,-1);
```
