get worksheet location from another cell to use in formula

pigsfoot

Board Regular
Joined
Dec 13, 2007
Messages
58
Office Version
  1. 365
Hi,
Apologies for the rubbish title. I have lots of formula's that reference other worksheets in other files and rather than keep typing the full path into each formula i was wondering if i could store the location in a cell and then reference that via my formula.

i.e. A1 =[Worksheet1.xlsx]Sheet1!

current formula = (INDIRECT("[Worksheet1.xlsx]Sheet1!M"&$E$2))

but replace = [Worksheet1.xlsx]Sheet1! with A1

Is that possible ?

Thanks
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
As you're already using INDIRECT, you're halfway there.

=INDIRECT(A1&"M"&$E$2)
 
Upvote 0
Perfect thanks, just found another issue. Indirect only seems to work when the other workbook is open, any ideas on how to reference a closed workbook :(
 
Upvote 0
so would there be an alternative forumula to use other than Indrect that woudl give the same result? I'm just trying to reduce the number of worksheets in one file, currently up to 16 and need to add more.
 
Upvote 0
As I said, you can only refer to a closed workbook with a regular formula, that means a formula where you enter the reference in full.

If you want to have part (or all) of the reference in a different cell then you need to use INDIRECT with the other workbooks open.
 
Upvote 0
There is a workaround, but in my opinion it will take more effort than entering the references properly, it is also more prone to error.

Using your simple example formula, you would need create your formula as a text string by using a longer formula like

="=INDIRECT("""&$A$1&"M"&$E$2&""")"

Then copy all of your formula cells, paste special > values in order to convert the first formula to a proper text string that represents your final formula, yo would then need to use find and replace to convert the text strings to formulas by replacing = with =

Good luck getting that right with anything more complex than a single cell reference.
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,238
Members
448,555
Latest member
RobertJones1986

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