=SUM formula changing when I delete rows

mickyd67

Board Regular
Joined
Jul 13, 2011
Messages
70
Office Version
  1. 365
Platform
  1. Windows
The experts will take a nanosecond to answer this, I'm sure.

=sum(A1:A100)

If I then delete 50 rows my formula changes to =SUM(A1:A50)

How do I stop that happening? (don't say "don't delete any rows" :LOL:)
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Try:
Excel Formula:
=SUM(INDIRECT("A1:A100"))
 
Upvote 0
Solution
How about
Excel Formula:
=SUM(A1:INDEX(A:A,100))
 
Upvote 0
Thanks to you both (I've been offline for a bit) - the first answer worked for me, I didn't try the 2nd answer yet.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0
Try:
Excel Formula:
=SUM(INDIRECT("A1:A100"))

Hello - I have another question on this one.

What if I wanted to use this formula in one tab, but calculate a sum from another tab?

i.e.:

=SUM(INDIRECT("A1:A100")) - but I want that formula to calculate data in a tab called: "Dashboard & Power Query Data"

I've tried a few things but I keep getting an error.

Anyone got any idea?

Thanks.
 
Upvote 0
=SUM(INDIRECT("A1:A100")) - but I want that formula to calculate data in a tab called: "Dashboard & Power Query Data"
Try:
Excel Formula:
=SUM(INDIRECT("'Dashboard & Power Query Data'!A1:A100"))
(note the use of single quotes around the sheet name due to the spaces in the name).
 
Upvote 0
Try:
Excel Formula:
=SUM(INDIRECT("'Dashboard & Power Query Data'!A1:A100"))
(note the use of single quotes around the sheet name due to the spaces in the name).

Thank you again - I think it was the single quote that was catching me out.
 
Upvote 0
OK - hopefully one last question....

If I want to use COUNTIF and reference another page I get an error message.

For instance

=COUNTIF('02) Safety Level Status'!I5:I1500,">0")

But I want to put INDIRECT in there - the last part ,">0") seems to be catching me out.

Any suggestions?
 
Upvote 0
But I want to put INDIRECT in there - the last part ,">0") seems to be catching me out.
You only put INDIRECT around the range reference, not the whole formula.
So the format would be:
=COUNTIF(INDIRECT(range reference),">0")
 
Upvote 0

Forum statistics

Threads
1,216,207
Messages
6,129,503
Members
449,512
Latest member
Wabd

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top