Visst är det möjligt. Du angav dock inte din kod så jag ger dig pseudokod.
writeheader();
$team = $data[0]['team'];
$count = 0;
foreach($data as $row){
$count += 1;
//if the current row's team is different than previous than add seperator
if($row['team'] != $team){
$team = $row['team'];
writeseperator();
writetotal($count);
$count = 0;
}
writerow();
}