Formula changes when rows are deleted, how to prevent.

OfficeUser

Well-known Member
Joined
Feb 4, 2010
Messages
544
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I am using a simple formula such as this: =COUNTA(Sheet1!D2:D20)

The problem is that anytime a row is deleted from 1 to 20, the formula adjusts itself. How do I prevent this from happening? I have been tinkering with the INDIRECT function but have had no luck making it work. Thanks!
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Try:
=COUNTA(Sheet1!$D$2:$D$20)
 
Upvote 0
The only thing that I can think of is instead of deleting the whole row, just clear the range in that row that has data.
 
Upvote 0
The only thing that I can think of is instead of deleting the whole row, just clear the range in that row that has data.

So this is all triggered as a user selects a label on a userfom, the userform set of data highlites green, the row is copied to another sheet, and the count goes up. If they click on that particular label again to deselect, the data goes back to black .backcolor and the row is removed from the sheet, and the count goes down, this is where the formula changes itself. I could write a simple bit of code to write the formula each time but I am trying to avoid it as I would think there was a less involved way. Thanks for the suggestion, I do appreciate it.
 
Upvote 0
Sorry I couldn't be of more help. Re-writing the formula may be the way to go.
 
Upvote 0
Sorry I couldn't be of more help. Re-writing the formula may be the way to go.

You are probably correct, whats a few more lines of code when I think it is around 83k lines currently. This project has saved so much time and is about to save even more daily. We have also eliminated 100% of the paperwork in one functional area utilizing this spreadsheet.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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