A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
If all you want to do is collect the values in the Amount column that correspond to the text "Total" in the Charge column, enter this formula in D2. It will generate an array of total values at the top of column D.
=FILTER(C:C,B:B="Total")
If you want the total to appear to the right of the first line in each grouping, then enter the following in D2:
=IFS(A2="","",A2=A1,"",TRUE,LET(t,MATCH("Total",B2:B$99,0),INDEX(C2:C$99,t,1)))
Change the final row number ($99) twice to match your data and copy the cell down column D to the end of your data.
The first two tests determine if this is the row to display the total in. If yes, then find the total row and display its value here.
Otherwise, you need to provide a much more detailed description of what data you want to collect and where you want the collection stored.