Data Validation using a Named Formula

craig159753

New Member
Joined
Apr 21, 2015
Messages
24
So I am using data validations to create drop down menus, however they act dynamically, and so the list generate depends on the value on the current sheet.

To do this i select the cells i want to add the data validation to, and then select data validation from the toolbar, then set Allow to LIST and then past this code in the SOURCE bar

=IF(ISBLANK($B$2),"",INDIRECT("'SDTMIG 3.1.2'!$E$"&MATCH($B$2,'SDTMIG 3.1.2'!$C$2:$C$872,0)+1&":$E$"&LOOKUP(2,1/('SDTMIG 3.1.2'!$C$2:$C$872=$B$2),ROW('SDTMIG 3.1.2'!$C$2:$C$872)-ROW('SDTMIG 3.1.2'!$C$2)+2)))

It works fine for the first sheet I define the new formula name. But if i go back to look at the code it has changed ever so slightly, and does not work on the other sheets properly. The change makes the formula look like this

=IF(ISBLANK(SHEET1!$B$2),"",INDIRECT("'SDTMIG 3.1.2'!$E$"&MATCH(SHEET1!$B$2,'SDTMIG 3.1.2'!$C$2:$C$872,0)+1&":$E$"&LOOKUP(2,1/('SDTMIG 3.1.2'!$C$2:$C$872=SHEET1$B$2),ROW('SDTMIG 3.1.2'!$C$2:$C$872)-ROW('SDTMIG 3.1.2'!$C$2)+2)))

So you can see for some reason it adds the extra "SHEET1" to three parts of my formula, but i simply want to be $B$2. The scope of the named formula is the whole work sheet.

Is there a way to stop SHEET1 popping in?
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Try replacing each instance of...

Code:
SHEET1!$B$2

with

Code:
!$B$2

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,214,839
Messages
6,121,891
Members
449,058
Latest member
Guy Boot

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