1

I'm trying to write a formula to add the contents of a column in cell D5, so normally I would write =SUM(D2:D4). However, the location of the formula cell (currently D5) will change as I add more rows. How do I write a formula that accounts for this?

(The formula I want would hypothetically look something like =SUM(D2:CellAboveCurrentCell).)

Thank you!

Carli S
  • 37
  • 5

2 Answers2

2

Try this formula:
=Sum(D2:INDIRECT(ADDRESS(ROW()-1,COLUMN())))

See this post for a more detailed explanation.

mcernak
  • 9,050
  • 1
  • 5
  • 13
1

You can use INDEX function:

=SUM(D2:INDEX(D:D;ROW()-1;1))

enter image description here

basic
  • 11,673
  • 2
  • 9
  • 26