Hi Mairen,
U can accomplish this without using code.
Assume that u have 3 total fields namely TotalA,TotalB,TotalC.
Also assume that ur repeating section fields are "Category" and "Amount".
1)Double click on the TotalA text box.
In the dialog that opens,there is a default value textbox.Beside that there is button(fx).
Click that.
2)In the "Insert Formula" dialog that opens,click the "Insert Function" button and select "Sum"
Now select the Amount field such that ur formula looks as follows.
sum(Amount).
3)Also while selecting the Amount field, go to the filter and specify "Category = a".Now ur formula will look as sum(Amount[Category= "a"])
4)Repeat the same for the TotalB,TotalC fields.
Regards,
Abhishek