Stop new lines changing formula

MJLP

New Member
Joined
Mar 26, 2008
Messages
21
I have this formula in a spreadsheet:

=COUNTIFS($B$7:$B$998, "*"&B$2&"*" etc...

My problem is, when people add new lines to the spreadsheet for new data, the formula automatically changes.

For example, if someone added a new line, and moved row 7 down, I would want the formula to still include this new line, but it automatically updates to:

=COUNTIFS(Incidents!$B$8:$B$999, "*"&B$2&"*"

Is there anyway to stop this from happening?

Thanks!
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Thanks for the reply.

I am having a little trouble as the reference is actually for a different sheet, the formula is:

=COUNTIFS(YTD!$B$7:$B$998,

Should I make it:


=COUNTIFS(INDIRECT("YTD!$B$7"):$B$998, etc</pre>
 
Upvote 0
From the help file:
Returns the reference specified by a text string

In other words: "$B$7" will be seen as a text string by Excel and will therefore not be altered when you insert a new row above. It will be evaluated later by INDIRECT, which turns it into a range reference, completing $B$7:$B$998.
 
Upvote 0
Great stuff - thank you very much for taking the time to help me out, it is very much appreciated!

I don't think I would ever have worked this out on my own!
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,215
Members
448,554
Latest member
Gleisner2

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