+ Reply to Thread
Results 1 to 5 of 5

Have formulas reference file names to look for data

  1. #1
    Forum Contributor heytherejem's Avatar
    Join Date
    07-06-2017
    Location
    Hampshire, England
    MS-Off Ver
    2016
    Posts
    152

    Have formulas reference file names to look for data

    Hi there,

    I have built a template in excel which simply references fields in various tabs in a document, and puts the information into a single row.

    The information the template needs to reference is held in excel files of a consistent format.

    What I want is to have column A contain the excel file names, and the template formulas use the file name, and the consistent cell references and pull the data in from all the files.

    At the moment, the template just references the original document for example:

    ='[DocumentA.xlsm]TabA'!B1

    What I want, is to replace the '[DocumentA.xlsm] with what is written in Column A. TabA and B1 would remain the same.

    Is this possible?
    Last edited by heytherejem; 10-26-2021 at 09:33 AM. Reason: Changed my idea

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: When copy/pasting formulas into new file, have formulas reference new file

    You could use the =CELL("filename",[ref]) function to give the filename of the active sheet and then use a combination of =SUBSTITUTE() and =INDIRECT() to give the full reference.
    Last edited by sweep; 10-26-2021 at 10:51 AM. Reason: OP changed - no longer relevant
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

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

    Re: When copy/pasting formulas into new file, have formulas reference new file

    Note that the INDIRECT function does not work with files that are closed, so you would have to ensure that the source file is open, as well as the file with the formula.

    Hope this helps.

    Pete

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,791

    Re: Have formulas reference file names to look for data

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, if you have not already done so, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of all those who offered help.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  5. #5
    Forum Contributor heytherejem's Avatar
    Join Date
    07-06-2017
    Location
    Hampshire, England
    MS-Off Ver
    2016
    Posts
    152

    Re: When copy/pasting formulas into new file, have formulas reference new file

    Thanks sweep this worked.

+ 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. Macro to create a copy of XlSB file and save as XLSX file without any formulas.
    By Mysore in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-28-2016, 03:11 AM
  2. Replies: 5
    Last Post: 03-30-2016, 12:32 PM
  3. Using Cell references in file paths for formulas to create dynamic formulas
    By MichaelStokesJr in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-04-2013, 11:49 AM
  4. Replies: 5
    Last Post: 09-25-2013, 02:51 PM
  5. Open 2nd file(CSV) from cell reference, copy columns to main file & close 2nd file
    By Langchop in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-31-2013, 05:09 AM
  6. file name in a cell to use it as reference for formulas
    By cybersandokan in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-19-2007, 11:14 AM
  7. copy file without formulas
    By djfatboyfats in forum Excel General
    Replies: 0
    Last Post: 04-16-2007, 07:10 PM

Tags for this Thread

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