read from a file and calculate values for a specified field

hi guys im running into a problem here im trying to calculate a sum a values from a field for example a hava a file caled <filename> and it has $3 fields, and i want toextract a group of values from field &1 and compute the sum of values from $3 accordingly this is my code so far...

awk -F: '{TEAMCOUNT[$2]=TEAMCOUNT[$2]+$3}
{
for ( i in TEAMCOUNT )
print TEAMCOUNT [i]" " i
}
~
at the end when i execute it it seems that keep track of the count but it prints the value repetitively i want the sript to calculate the total value for example
<keyword" <sum of total values>
<keyword_1" <sum of total values for keyword_1> and so on
guys any help or suggestion would be greatly appreciated
thanks

Post a part of your file and explain which column you want to totalize under what conditions.
Place your code next time within code tags to improve readability (select your code and press the "#" sign at the toolbar).

Regards

just a little change required - you want to END, then loop the values and print i.e.:

 awk -F: '{TEAMCOUNT[$2]+=$3}END{ for ( i in TEAMCOUNT ) {print TEAMCOUNT " " i}}' infile

could you explain why the end is needed ... just for future reference ................. thanks in advance