Thank you.!
So the ratings will be set values picked by a group of us, no randomising needed there
If we forgot about the 4 individual sets of values for now and just gave each an overall rating 1-10 the question is how to create 8 groups of 5 names without repeating a name, and as @verreauxi said making each team total rating be in the mid range…
Although I was thinking mid range may not actually be between a team of 5 players ranked as 1 and 5 ranked as 10, but perhaps needs to be specific to the total actual ratings of the top 5 and Bottom 5 players. As such the best possible team from my ratings would be 42 and worst would be 15….so midrange 28.5…..so all teams to have a total rating of between 26-31
The problem here is that you aren't randomly assigning players if you want teams to be more or less evenly distributed. I don't know what Excel can do (on the upper end, except that it has a lot of financial tools) and know nothing about VB, but maybe that's your solution. I think if you want to learn the programming you can probably figure this out with some help and generate "random assignment" based on your parameters. Otherwise I'd stick to the pencil and paper method you're using. I am doubtful excel can do what you want easily, but I would like to see it if you build it.
Seems like you want a table of player values from which you can calculate an average player value. From there you can determine the target team value (avg value x number of players). Begin by randomly assigning players to teams, but as you remove players from the pool you need to update both the remaining average player value and the min/max player value and you'll need some program/layer/application that can sort through and limit a distribution that moves teams too far from the target value (or maybe a target range). Or maybe ask a programmer to help and discard everything I wrote.