I don't think it would be hard to put in an algorithm where if 3 guys are level 3 and 7 are level 4, you'll end up with a unit that is rank 3.7. That would simply mean they are 70% of the way to rank four.
So...it would be:
((men/total men) * current rank) + etc. for how many ranks you have in your squad.