Hi
You have formulae inserted which does this for you. apart from in section 2, your formula is creating a circular reference.
It should be
=SUM(E4:E6) and not =SUM(E4:E7)
If you are saying that you want the formula to appear any time you insert the Subtotal in the first column, then that could only be achieved with VBA.
However, if you makes each data set into a Table with Insert tab > Table > my table has headers after you have given a title to each of the lcells to the left of "rs.",
then when you cursor is anywhere within the Table created, if you clcik on the Design tab, you can select Total row from the Table Style Options section
This will place a Total row at the end of your table, which will move down and adjust as you insert more rows.
When you press Tab, after entering values in the rs column, Excel will automatically insert a new row above the total row, adjust the formula and put you in the first cell of the new row.
See attached file for examples