This is probably a simple Combination problem but I can't think of how to solve it in LibreOffice. I run multiplayer games along with seven of my friends, on two teams of 4 players each, for a total of eight players. Each player is assigned a skill score. How do I "balance the teams" by calculating the correct team combination that will result in the lowest possible difference in average skill score between the two teams?
I think the correct approach is to calculate every possible permutation of the teams, calculate the permutation with the lowest average difference, and then return that team roster.
I'm not sure if this is a very well-known problem whose solution is obvious to spreadsheet programmers or whether I'd need to write some code to solve this problem.
This looks like an optimization variant of the partition problem; essentially, I think you do need to calculate all possible permutations.
Let the sum of all scores be $S$; for each four person subset (of which there are $8\cdot7\cdot6\cdot5/4! = 70$ possibilities) compute the sum $k$ hence the average $k/4$; then compute the complement four players' average as $(S-k)/4$.
Even this approach double counts; so really there are only $35$ possibilities to check.
You could do this by hand!