You make a table with designation and sum total in each entry.
Accumulate sum total per current designation. When designation changes, put the previous designation and sum into the table. Initialise sum to current value and store new designaiton. Continue until end.
At the end of all your input you will have a table of sums by designation, which you can do whatever you then want with.
If you input is not sorted on designation you will need to do the accumulation in the table, have found a matching entry for designation or, if no matching entry, create a new one.