Formula changing to #REF

DeCaelo

New Member
Joined
Mar 17, 2011
Messages
29
The below formula links to an empty cell which is only populated once a macro is run.

=SUMPRODUCT(--('Failures-Data'!$C$2:$C$1000=$C$2),--('Failures-Data'!$B$2:$B$1000=$N$5))

When the macro runs the formula changes to:

=SUMPRODUCT(--('Failures-Data'!#REF!=$C$2),--('Failures-Data'!#REF!=$N$5))

How do I go about stopping the formula from changing?
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
The below formula links to an empty cell which is only populated once a macro is run.

=SUMPRODUCT(--('Failures-Data'!$C$2:$C$1000=$C$2),--('Failures-Data'!$B$2:$B$1000=$N$5))

When the macro runs the formula changes to:

=SUMPRODUCT(--('Failures-Data'!#REF!=$C$2),--('Failures-Data'!#REF!=$N$5))

How do I go about stopping the formula from changing?
Maybe this...

=SUMPRODUCT(--(INDIRECT("'Failures-Data'!C2:C1000")=$C$2),--(INDIRECT("'Failures-Data'!B2:B1000")=$N$5))

Note that that formula will ALWAYS refer to those ranges. If you were to insert rows/columns on that sheet the formula references will not update to reflect such.
 
Upvote 0
When the macro runs the formula changes to:

=SUMPRODUCT(--('Failures-Data'!#REF!=$C$2),--('Failures-Data'!#REF!=$N$5))

How do I go about stopping the formula from changing?
Do you think it may be feasible to instead change what the macro is doing so that the formula problem doesn't occur?
 
Upvote 0
Maybe this...

=SUMPRODUCT(--(INDIRECT("'Failures-Data'!C2:C1000")=$C$2),--(INDIRECT("'Failures-Data'!B2:B1000")=$N$5))

Note that that formula will ALWAYS refer to those ranges. If you were to insert rows/columns on that sheet the formula references will not update to reflect such.

This works perfectly, thankyou :D
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,256
Members
452,901
Latest member
LisaGo

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