Look at the base creature that is going to be templated and used as a summoned monster. Determine the creatures CR modifier before adding a template. Template abilities are not figured in determining summoning CR.

CR Modifiers
Class Level +1 CR per level
Creature has flight +1 CR
2 Special Attacks +1 CR
Spell Immunity +2 CR
Can cast spells +1 CR
Continual Spell Always in Effect +1 CR
Able to do 7th level spell +1 CR
Able to do 8th level spell +2 CR
Able to do 9th level spell +3 CR
4-7 Hit Dice +1 CR 8+ Hit Dice +2 CR
12+ Hit Dice +3 CR
15+ Hit Dice +4 CR
20+ Hit Dice +5 CR
30+ Hit Dice +6 CR
40+ Hit Dice +7 CR
50+ Hit dice +10 CR
Huge Size +1 CR
Gargantuan Size +2 CR
Colossal Size +3 CR

Once you have added the creatures CR and modified CRs together use the following chart below to determine what level summon spell the monster falls into. The creatures modified CR cannot be higher than the CR mentioned on the right (see below)

Summoning CR's
Summon Monster I CR 1/2
Summon Monster II CR 1
Summon Monster III CR 2
Summon Monster IV CR 3-4
Summon Monster V CR 5-8
Summon Monster VI CR 9-10
Summon Monster VII CR 11-12
Summon Monster VIII CR 13-15
Summon Monster IX CR 16-20

Example:

A Tyrannosaurus is normally CR 8. It has the following modifiers +4 CR (for 15+ HD), +1 CR (for 2 special attacks improved grab and swallow hole), +1 CR (huge size).

CR 8+4+1+1= CR 14

Using the Summoning CR chart above we can see that a CR 14 monster can be used as a Summon Monster VIII spell. Therefore a celestial Tyranosaurus can be summoned as your summon monster VIII.

Example:

A Gargoyle is normally CR 4. It has the following modifiers +1 CR (4 hd), +1 CR (Flight).

CR 4+1+1= CR 6

Using the Summoning CR chart above we can see that a CR 6 monster can be used as a Summon Monster V spell. Therefore a fiendish Gargoyle can be summoned as your summon monster V.