Changing a file name in a formula with data validation

acellis9

New Member
Joined
Apr 25, 2011
Messages
1
I'm sorry if this is a duplicate post. I looked around but was unable to find an answer for my problem. I'm attempting to use a drop-down data validation menu to change my source file in a formula. For example: cell B1 contains a formula linking to a cell in another workbook, ='[Sales_16-Washington.xls]Area2'!$O$25 where "16" is the week number.

I want for "16" to link to a drop-down menu where I can select other numbered weeks and have the data repopulate. I already have the week list/menu created in cell A1, I just don't know how to get excel to recognize that "Sales_$A$1-Washington.xls" is a cell reference within a file path.

I would like to be able to change the sheet reference as well, also using another drop-down menu.

So by changing two drop-down's, the formula would change to ='[ABC_23-Washington.xls]Area5'!$O$25

I really appreciate any help you might be able to offer. Thanks for taking a look!
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hello and Welcome,

There might be a better way to do this, but one option is to use the =INDIRECT function. Using ampersands to separate Text and Cell References, you build your formula.

Rich (BB code):
=INDIRECT("'[Sales_" & A1 & "-Washington.xls]Area2'!$O$25")

One problem with using INDIRECT to build a reference to another workbook is that links to a workbook include the File Path when the linked workbook is closed (but not when it is open).

If you know your linked workbook will always be open or always closed when you use the workbook with your Validation List choices, that isn't too hard. Otherwise your approach would need to handle both conditions.
 
Upvote 0

Forum statistics

Threads
1,224,564
Messages
6,179,547
Members
452,925
Latest member
duyvmex

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