There's little icons when you go to add to another group, you click them to give a preference to what you are sending, like one is for shield I think, you could click it and send mostly shield to one group and leave the 2 handers in group 1.
I tested a little in custom battle. The opportunity to choose a formation before the battle begins with 21 people in the squad. I chose two types of troops with shields (battanian picked warrior, battanian wilding) and two types of troops with two-handed swords and polearm weapons (falx. Before the battle, I clicked on a small icon with a shield and the warriors were divided correctly into two squads.
But there are two problems:
1) I can't check what will happen if, for example, there will be much more warriors with shields than warriors without shields, whether the units will be divided correctly. The features of custom battle do not allow me to do this
2) I need to divide the warriors as accurately as possible every time, for example, the screenshot (
https://postimg.cc/CRpjWFnn) shows that I made two divisions of 15 by 5, I have 10 warriors with shields and 10 warriors without shields. And it is clear that the warriors without a shield moved to the first line to the warriors with a shield. It turns out that I need to cut off warriors without shields very accurately every time with the slider before the battle