+ Reply to Thread
Results 1 to 7 of 7

Reference / retrieve data from a table and populate a table in a different workbook?

  1. #1
    Registered User
    Join Date
    02-12-2012
    Location
    Long Beach, CA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Reference / retrieve data from a table and populate a table in a different workbook?

    I've been struggling with how to use data from two different columns (A & B in Target.xls) to get a number from a specific cell in a different file (Source.xls) and return the value of the referenced cell, populating a third column in (C) the Target.xls file. Please see example below... Any help would be VERY much appreciated! -Philip

    p.s. I also have a freelance VBA project to contract out if a good developer can be located here! Many thanks.

    Source.xls

    A B C D
    1 Big Little Ugly
    2 Jack 23 1 300
    3 Steve 46 90 5
    4 Mary 8 11 0

    Target.xls

    A B C
    1 Big Steve
    2 Ugly Mary
    3 Little Steve
    4 Big Jack
    5 Ugly Jack

    Desired (after macro):
    Target.xls

    A B C
    1 Big Steve 46
    2 Ugly Mary 0
    3 Little Steve 90
    4 Big Jack 23
    5 Ugly Jack 300

  2. #2
    Forum Contributor
    Join Date
    06-16-2011
    Location
    London
    MS-Off Ver
    Excel XP
    Posts
    276

    Re: Reference / retrieve data from a table and populate a table in a different workbo

    I think I get what you're after here. Will the files always be in the same folder? if so you can store the path to source.xls in a cell in target.xls and....

    Please Login or Register  to view this content.
    Last edited by swoop99; 02-12-2012 at 09:16 PM.

  3. #3
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Reference / retrieve data from a table and populate a table in a different workbo

    Your layout is not 100% clear from that post, but I think you mean
    =INDEX('[source.xls]Sheet1'!$B$2:$D$4,match(B1,'[source.xls]Sheet1'!$A$2:$A$4,0),match(A1,'[source.xls]Sheet1'!$B$1:$D$1,0))
    Good luck.

  4. #4
    Registered User
    Join Date
    02-12-2012
    Location
    Long Beach, CA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Reference / retrieve data from a table and populate a table in a different workbo

    Rory - you've done it! In a single line, no less.

    Do you know how I would write this into a macro script? (so the source file is automatically referenced without my having to select it?)

    Thanks a million.
    - Philip

  5. #5
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Reference / retrieve data from a table and populate a table in a different workbo

    How would the script determine the source file name?

  6. #6
    Registered User
    Join Date
    02-12-2012
    Location
    Long Beach, CA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Reference / retrieve data from a table and populate a table in a different workbo

    The name of the source file won't change; it is an .xlsx file. The target filename will change, however. So could the source filename be hardcoded? Or when the script is run, excel can prompt the user to select the file? That is what happens when I use the formula you gave me, but I can't use it in a macro - it errors out...

    Thanks for getting back to me
    - Philip

  7. #7
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Reference / retrieve data from a table and populate a table in a different workbo

    Untested, but I think you are talking about something like this?
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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