Prevent Formula Change

Rubber Beaked Woodpecker

Board Regular
Joined
Aug 30, 2015
Messages
203
Office Version
  1. 2021
In sheet1 I have the following formula which very well;

Excel Formula:
=IFERROR((COUNTIF('5.2'!$A3:C3,"0")-COUNTIF('5.2'!$A3:C3,"1")),"0")

However if I insert a new column in sheet 5.2 the formula changes to the following;

Excel Formula:
=IFERROR((COUNTIF('5.2'!$B2:D2,"0")-COUNTIF('5.2'!$B2:D2,"1")),"0")

Is there any way I can prevent the formula from changing please?

Many thanks

RBW
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
One way:
Excel Formula:
=IFERROR((COUNTIF(INDIRECT("'5.2'!$A3:C3"),"0")-COUNTIF(INDIRECT("'5.2'!$A3:C3"),"1")),"0")
using INDIRECT will ensure that the range in your formula will never change as you add/remove columns/rows, as everything inside of the INDIRECT statement is treated as text.
 
Upvote 0
Solution
One way:
Excel Formula:
=IFERROR((COUNTIF(INDIRECT("'5.2'!$A3:C3"),"0")-COUNTIF(INDIRECT("'5.2'!$A3:C3"),"1")),"0")
using INDIRECT will ensure that the range in your formula will never change as you add/remove columns/rows, as everything inside of the INDIRECT statement is treated as text.
Brilliant thank you :)
 
Upvote 0
You are welcome.

Note, when marking a post as the solution, please mark the original post containing the solution, not your own post acknowledging some other post is the solution.
I have updated this for you.
 
Upvote 0

Forum statistics

Threads
1,215,147
Messages
6,123,296
Members
449,095
Latest member
Chestertim

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