sort data so that smaller departments appear on top