you can easily do all the tasks using Linq
You can do this task using OrderBy method.It’ll sort all the data as shown in the image and it’ll write the data in a new sheet.
For this task first i grouped all the data and took the distinct value’s than looping those data filtered it one by one and wrote in a different and naming the sheet of the site.
So what we get is a batch of different and then used Sum method to sum the Amount Column and wrote it in our batch Sheet.
Check this workflow and excel for better understanding
Saw your sheet and the issues with it.
I have added a Non breaking space to all the values in the accounts column and wrote it once again in a sheet so now the excel sheet wont automatically truncate all the zero’s