File reference from cell

NikToo

Board Regular
Joined
Sep 24, 2015
Messages
66
Office Version
  1. 365
I'm trying to do something that looks up a value in a file based on a source directory as defined in a cell. So I have in cell M5 in this case a directory, like "C:\Users\111222333\Documents\Source", and in another cell I want to display a value in a cell in the file C:\Users\111222333\Documents\Source\data.xls.

I can write it out in full, adding Sheet!A1 for example. The problem is that I want to be able to change the source directory in M5. What would the syntax be for that?

Thanks
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
You could try something like this:

=INDIRECT(M5&"\data.xls")

Thanks. It should theoretically work, but I'm getting an error. My file name has spaces in it, so how would I reference it all? Like this: "\My data file.xlsb!Sheet1!A1"?
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,334
Members
449,077
Latest member
Jocksteriom

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