+ Reply to Thread
Results 1 to 4 of 4

Reference filename based on cell contents

Hybrid View

  1. #1
    Registered User
    Join Date
    06-20-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    12

    Reference filename based on cell contents

    I can hardly think of a way to title this question easily to describe what I'm trying to achieve.

    I have a program dumping heaps of .csv files that I am trying to analyse in Excel. The file names are consistent enough for me to use lists in Excel so that I can use something like = CONCATENATE(,,) to quickly and easily build the filename(s) with cells in Excel.

    I would like to then use the information within this cell to reference the file name I am wanting to pull data from. In this case use =VLOOKUP().

    The VLOOKUP looks like this:

    =VLOOKUP($C$3,'(CONCATENATE(B15, " ", "53%","Fe", " Cutoff.csv"))'!$B$6:$J$50,F$1+1)

    or

    =VLOOKUP($C$3,'(B16)'!$B$6:$J$50,F$1+1)

    where B16 would contain the name of the reference file

    Hopefully this makes sense and someone has some ideas.

  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,454

    Re: Reference filename based on cell contents

    You need to make use of the INDIRECT function.

    =VLOOKUP($C$3,INDIRECT(B16&"'!$B$6:$J$50"),F$1+1)
    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 Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Reference filename based on cell contents

    You can use indirect(), which takes a string as an argument and uses it as a reference to lookup, this is volatile (significant increase in workbook processsing load) and, more to the point, only works if the specified workbook is open at the time.

    You can get around this second issue with indirect.ext:
    http://www.*****-blog.com/archives/2...sed-workbooks/

    I would recommend you get used to indirect first with an open workbook (you can use it on sheets in the same workbook to test it out) then expand to indirect.ext

    hth

    PS
    the blog belongs to a guy named "richard"... it has been bowdlerised, replace the ***** with 'd i cks' (no spaces)

    rofl
    Last edited by Cheeky Charlie; 01-06-2010 at 06:36 AM. Reason: PS

  4. #4
    Registered User
    Join Date
    06-20-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    12

    Smile Re: Reference filename based on cell contents

    Thanks guys, that works a treat

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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