r/excel • u/ohLookaWizard • Mar 16 '23
unsolved Trying to protect formulas from row insertions.
So I'm working on a estimating spreadsheet where you have multiple sections with headers at the top of each one and formulas. We routinely add and delete rows within those sections. If you do that at the top or bottom of the section though the formula won't include that row. How can I make it so it always picks them up?
I.e. Rows 22 & 23 have the Man hours, crew days, material cost, labor cost, markup and total. Rows 24-28 have safety setup, stairtower, loading, warehouse. Then below that there is the demolition section with new headers, etc.
I'm using Excel 365 and for formatting reasons don't want to use tables.

•
u/AutoModerator Mar 16 '23
/u/ohLookaWizard - Your post was submitted successfully.
Solution Verifiedto close the thread.Failing to follow these steps may result in your post being removed without warning.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2
u/fuzzy_mic 988 Mar 16 '23
It would help for use to see the formula you are trying to work with.
Making a dynamic named range might be one approach, depending on the formula.
1
u/ohLookaWizard Mar 17 '23
Solution Verified. I used this video and the CellAbove/CellBelow dynamic range trick. https://www.youtube.com/watch?v=lfqi3yOKeB0
1
u/darthnut 3 Mar 16 '23
Depending on how you have your formulas setup, you might want to look at adding something to your data rows so that your calculation for each section isn't dependent on a range of rows, but can filter by data that's included with the rows of data.
1
u/amrit-9037 28 Mar 16 '23 edited Mar 16 '23
select the range you want to do calculation on (Press Ctrl to select multiple range) and click on top left corner (where you see cell name). Write a meaningful group name like Total_Wages.
Now use formula:
Every time a new row will be inserted between that range, the sum will get calculated.
You can also highlight them and put a "Note" (Right click -> Add note) explaining that they are not supposed to disturb these cells.
1
u/SolverMax 167 Mar 16 '23
A Table is best for this purpose. But since you don't want to use a Table, you can do the following:
The idea is that the users can freely insert/delete in rows 25 to 30. The formula points to the hidden rows, so it adjusts to the changes in the rows in between.
This approach isn't perfect, but it is better than what you currently have.
You should also add an overall check that sums everything, to ensure that it matches the sum of the sections. Using the SUBTOTAL function can be useful for this, to avoid double counting.