get worksheet location from another cell to use in formula

pigsfoot

New Member
Joined
Dec 13, 2007
Messages
47
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
 

Some videos you may like

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

jasonb75

Well-known Member
Joined
Dec 30, 2008
Messages
12,399
Office Version
  1. 365
Platform
  1. Windows
As you're already using INDIRECT, you're halfway there.

=INDIRECT(A1&"M"&$E$2)
 

pigsfoot

New Member
Joined
Dec 13, 2007
Messages
47
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 :(
 

pigsfoot

New Member
Joined
Dec 13, 2007
Messages
47

ADVERTISEMENT

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.
 

jasonb75

Well-known Member
Joined
Dec 30, 2008
Messages
12,399
Office Version
  1. 365
Platform
  1. Windows
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.
 

jasonb75

Well-known Member
Joined
Dec 30, 2008
Messages
12,399
Office Version
  1. 365
Platform
  1. Windows
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,126,945
Messages
5,621,763
Members
415,854
Latest member
Tutu123

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