+ Reply to Thread
Results 1 to 5 of 5

Reading values from a file referenced in a cell

  1. #1
    Registered User
    Join Date
    02-28-2008
    Posts
    14

    Reading values from a file referenced in a cell

    I have a column with the folder name, a column with the filename and a column which creates the entire path to the data I want which is:

    '/Users/darren/Desktop/3401/[CAR Master.xlsx]Master'!$C$4

    If I use a cell containing:

    ='/Users/darren/Desktop/3401/[CAR Master.xlsx]Master'!$C$4

    then it reads the location C4 from tab Master in the excel spreadsheet "CAR Master.xlsx" in folder "/Users/darren/Desktop/3401" and I get the correct value.

    However if I use

    =INDIRECT(C3) I get #ref I have also tried =INDIRECT(C3,false) but still get #ref.

    Any ideas?

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,426

    Re: Reading values from a file referenced in a cell

    Unfortunately, the INDIRECT function can only work on files that are open, so you can't use it in this case.

    The only alternative that I know of (well, there are 2 actually) is to download the free add-in called morefunc - you can do a Google search for sites where you can download it from. Once installed, this has the extra function INDIRECT.EXT, which can be used with external (closed) files in the way you want. Some contributors here have noted that it works with Excel 2010, although it was originally written for much earlier versions of Excel, but I don't know about versions since then (and your profile doesn't state which version you are using).

    The second alternative is a PULL UDF written by Harlan Grove - again, written some time ago, and again you should be able to find it through Google.

    I think both these use the approach to open the external file in the background, retrieve the data, and then close the file.

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    02-28-2008
    Posts
    14

    Re: Reading values from a file referenced in a cell

    Thanks, I need it to work with the latest version and without add ons! If I specify specific locations I can access closed files......


    Yes just checked and I have 3 cells showing the contents of the same location in 3 closed files. But this is with

    ='/Users/darren/Desktop/3401/[CAR Master.xlsx]Master'!$C$4
    ='/Users/darren/Desktop/3402/[CAR Master.xlsx]Master'!$C$4
    ='/Users/darren/Desktop/3403/[CAR Master.xlsx]Master'!$C$4
    Last edited by cowasaki; 08-01-2018 at 05:27 PM.

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,426

    Re: Reading values from a file referenced in a cell

    Quote Originally Posted by cowasaki View Post
    ... If I specify specific locations I can access closed files......
    Yes, I know you can, but you want to have variable locations which are specified as text strings. Normally, you would use INDIRECT for this, but it doesn't work with closed files.

    Can you open the file in the background?

    Pete

  5. #5
    Registered User
    Join Date
    02-28-2008
    Posts
    14

    Re: Reading values from a file referenced in a cell

    It's 50 files which other people might need to open....

    Looks like I need to create a row on the hidden tab of each of the 50 files and copy the cell data to one line on that tab then place a direct read to the first cell

    ='/Users/darren/Desktop/3401/[CAR Master.xlsx]Hidden'!$C4

    Then copy this to the read only manager sheet into the first column for each file and then just copy it across allowing excel to increase the 4 to 5,6,7,8,9 etc

    then copy the first cell down as above, change 3401 to 3402 and do the process again. It's not as elegant but it will at least work

    Thank you for your input, it is appreciated.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Save a Workbook With A file path and name referenced cell
    By John Vieren in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-19-2013, 06:39 AM
  2. Problem in Reading Excel file for looking at threshold values.
    By magantiamala in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-13-2012, 04:17 AM
  3. vlookup to a dynamic file name referenced in another cell
    By chrisac79 in forum Excel General
    Replies: 3
    Last Post: 11-10-2011, 02:46 PM
  4. reading values in from a text file
    By thegoat001 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-28-2011, 07:03 AM
  5. [SOLVED] Vlookup, External File Name to a Referenced Cell
    By gjohn282 in forum Excel General
    Replies: 2
    Last Post: 05-23-2011, 07:03 PM
  6. Reading values from a text file
    By krish T in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 10-21-2010, 01:45 PM
  7. External File(s) referenced and file links change based on row cell.
    By Jimmydageek in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-23-2009, 02:59 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1