Real time Business Logic - Excel Summation based on rows using identifier

Guys, Thank you al for your responses. I had a change in logic due to the business requirement .
@ClaytonM @loginerror Can you guys please help me with the below issue?