Do it all in one go, not in multiple pass / loop.
Add a "priority" number instance variable to your cell family and do something like :
For each cell order by cell.priority
Then according to the type of cell, do the correct calculation. This way you'd loop over your cell collection only once.