Lock Reference so it never changes

ParanoidAndroid

Board Regular
Joined
Jan 24, 2011
Messages
50
Hi Guys

I want to lock the K:K in this line so it never changes

=IF(ISERROR(MATCH(V2,'3056_LCS'!K:K,0))

How do I do this?
 

Some videos you may like

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

xenou

MrExcel MVP
Joined
Mar 2, 2007
Messages
16,793
Office Version
  1. 2019
Platform
  1. Windows
Simplest is to add $ characters which keep the reference to K if you drag or copy the cells:
=IF(ISERROR(MATCH(V2,'3056_LCS'!$K:$K,0))

The reference will still change if you cut columns. Often that is desirable behavior. Otherwise, you could look into using INDIRECT(). I think something could even be done with INDEX() here too.
 

CWatts

Well-known Member
Joined
Jan 22, 2010
Messages
701
Just put a $ in front of each K so K:K would become $K:$K.

manipulating these reference locks is a very handy trick so practice with them.

You can lock a Column, but let the row number change with =$K2, or lock a row but let a column change with =K$2.
 

ParanoidAndroid

Board Regular
Joined
Jan 24, 2011
Messages
50
Thanks Guys

Yes, I cut columns..so that explains it.

The K:K is anticipated once all the columns are cut..

How do i used the indirect or index?
 

xenou

MrExcel MVP
Joined
Mar 2, 2007
Messages
16,793
Office Version
  1. 2019
Platform
  1. Windows
This should work:

=IF(ISERROR(MATCH(V2,INDIRECT("3056_LCS!$K:$K"),0))

There will be a performance hit using Indirect(), but it won't matter if your workbook is not heavy with calculations.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,484
Messages
5,596,407
Members
414,064
Latest member
Duncthegreat

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
Top