Share via

SUM formula

Ian3 66 Reputation points
2021-12-29T23:43:13.27+00:00

Column B needs to contain a formula to get total of Column A
A B
8 8
7 15
6 21

What is it to get below after insert a row under header of 'A B' ? Thanks
A B
9 9
8 17
7 24
6 30

Developer technologies | Visual Basic for Applications
0 comments No comments

Answer accepted by question author

David Rose 76 Reputation points
2022-01-02T05:19:59.143+00:00

Hi Ian

Happy New Year to you too.

When you insert a new row, all of the cells that have moved down as a result of the new row will have their formulas adjusted accordingly automatically. No need to do anything with them. The only cell that will need some help will be the cell in the new row in the column that has the formulas in it - in your example, column B. All you have to do to correct that is to go to the cell with the formulas in it above the inserted new row and drag the formula down to the new row. That will insert the correct formula into the new cell.

Hope this helps.
David

Was this answer helpful?

0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Ian3 66 Reputation points
    2022-01-01T00:01:36.117+00:00

    David,

    Thank you for your solution. After the formula =IF(A2="","",B1+A2) drag down, I get the right results.
    So the formula from B2 and below follow the format of =IF(An="","",Bn-1+An)
    Is there a way to keep the format in each cell after insert a row? Thanks

    Happy New Year!

    Ian

    Was this answer helpful?

    0 comments No comments

  2. David Rose 76 Reputation points
    2021-12-31T07:16:51.403+00:00

    Hi Ian

    In cell B1, enter the formula =A1
    In cell B2, enter the formula =IF(A2="","",B1+A2)
    Then drag the formula from cell B2 as far down the column as you need.

    I hope this solves your problem.

    David

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.