+ Reply to Thread
Results 1 to 6 of 6

Using a Filename in a cell as part of a formula

  1. #1
    Registered User
    Join Date
    10-04-2013
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    3

    Using a Filename in a cell as part of a formula

    I have a very simple problem it would appear but as a novice Excel user I just don't seem to be able to crack it.

    I have a folder containing hundreds of identical spreadsheets, each with several worksheets.

    I would like to collate them into a summary spreadsheet.

    To do this I thought to have a column containing the filenames of the spreadsheets and alongside this a cell referencing the cell in the corresponding spreadsheet. However, I wanted the formula in this cell to use the filename in the first cell as part of that formula.

    I just can't seem to get that formula right.

    Any help would be appreciated.

    Thanks.

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Using a Filename in a cell as part of a formula

    Use the =INDIRECT() function.

  3. #3
    Registered User
    Join Date
    10-04-2013
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Using a Filename in a cell as part of a formula

    Thanks yudlugar but it doesn't seem to work. To explain further:

    Say I have an open spreadsheet called File1 and I have a value in Cell A1

    In spreadsheet File2 Cell A1 contains the filename File1

    In Cell A2 I want the value of File1 A1 but the formula in this Cell A2 uses the Filename from Cell A1

    Something like ='[DIRECT(A1)]Summary '!A2

    Many thanks

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Using a Filename in a cell as part of a formula

    Ok, so in File 2 A2:

    =Indirect("'[" & A1 & "]Summary'!A2)

  5. #5
    Registered User
    Join Date
    10-04-2013
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Using a Filename in a cell as part of a formula

    I hope it's not me!!!

    I put in =INDIRECT('[" & A4 & "]Summary'!D24) and got a #REF! in C4 the cell I put the formula in.

    A4 is the actual Cell with the file name and D24 the actual cell in the other spreadsheet. Both spreadsheets are in the same folder. I took out the first " as it was coming up as an error.

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Using a Filename in a cell as part of a formula

    INDIRECT() does not work on closed workbooks

    For something like that, you will need to install the Morefunc add-in
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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. Copy slection and paste it in ceratian workbook with PART filename as cell value
    By Dibbley247 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 11-15-2012, 09:56 AM
  2. [SOLVED] How to retrieve part of a filename?
    By jonelamora in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-03-2012, 04:25 AM
  3. [SOLVED] Adding part of a filename to a specific cell.
    By Kramxel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-16-2012, 03:11 AM
  4. I need to use a date as part of my .xls filename.
    By Skot in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-11-2011, 11:06 AM
  5. Using a cell to form part of a filename
    By Anth in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-28-2005, 01:42 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