+ Reply to Thread
Results 1 to 7 of 7

Lookup for Values from Workbook A to Workbook B

  1. #1
    Forum Contributor
    Join Date
    03-27-2015
    Location
    Hong Kong
    MS-Off Ver
    Excel 2010
    Posts
    141

    Lookup for Values from Workbook A to Workbook B

    Dear Sirs,

    I'm currently got stucked in finding a simple Excel function that should be able to accomplish the task, but to my level of skills, none of the VLookup / HLookup / Sumif / Sumifs seem to work.

    I would like to know what should be the best Excel function to use for cells B15 / B21.

    Screen.JPG

    I also attached an Excel file for easy reference.

    Grateful if anyone could help.

    Thx in advance
    Attached Files Attached Files

  2. #2
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Lookup for Values from Workbook A to Workbook B

    B15 =INDEX($B$3:$H$8,MATCH(A15,$A$3:$A$8,0),MATCH(B14,$B$2:$H$2,0))

    The result should be 4, not 5.

    You can then copy and paste the formula into cell B21.

  3. #3
    Forum Contributor
    Join Date
    03-27-2015
    Location
    Hong Kong
    MS-Off Ver
    Excel 2010
    Posts
    141

    Re: Lookup for Values from Workbook A to Workbook B

    Thanks for your advice.

    I've further modified the formula to cover a wider range for the Table in File A.

    But there is a case, which the formula may need further adjustment :
    as there is another section to the right, although Loc are all in same row 2.
    File C cell B23 will not get the correct result.

    Screen2.JPG



    Is there any remedy for this situation ?

    Thanks again.

  4. #4
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Lookup for Values from Workbook A to Workbook B

    The formula in B23 looks for the first instance of "P6" in column A. That is in row 10.

    I see that you now have another column of "P#" values in column H but those do not align with those in column A.
    In column H, "P6" is in row 11.

    So should the formula in B23 look for "P6" in column A or column H?

  5. #5
    Forum Contributor
    Join Date
    03-27-2015
    Location
    Hong Kong
    MS-Off Ver
    Excel 2010
    Posts
    141

    Re: Lookup for Values from Workbook A to Workbook B

    Yes, that's the problem.

    File A's Loc can be aligned in same row 2. But since this File A cannot be standardized, column H to column J are in fact cut and pasted from another file, while column H's P1 to P6 usually cannot be aligned with that in column A.
    So the formula in B23 should be able to lookup for Loc6 (ie column J) against column H (instead of column A), and this is the headache.

    I previously used HLookup to get the correct column for Loc, and down designated rows 9 to get the correct value 11 (cell J10). But this is no better than your suggested INDEX/MATCH formula, because this month is down 9 rows for P6, the next month may be down 12 rows for P6.

    Perhaps I should give up at this point, unless you have another ingenious idea.

    Regards

  6. #6
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Lookup for Values from Workbook A to Workbook B

    For your new requirement, you can use this in B23:

    =IFNA(INDEX(B3:F10,MATCH(A23,A3:A10,0),MATCH(B22,B2:F2,0)),INDEX(I3:J11,MATCH(A23,H3:H11,0),MATCH(B22,I2:J2,0)))

  7. #7
    Forum Contributor
    Join Date
    03-27-2015
    Location
    Hong Kong
    MS-Off Ver
    Excel 2010
    Posts
    141

    Re: Lookup for Values from Workbook A to Workbook B

    I've tried your new formula, but get #NAME?. However if I change IFNA to ISERROR, I seem to get the correct answer.

    Actually I get your point.

    But I think I should get File A standardized in the first place, by having P1 to P6 aligned between the 2 sections on the left and on the right (but this may be a difficult task as these 2 sections are sourced from other colleagues). The reason being the left section next month may be extended to column H (ie from column B to column H), and the right section (will then start from column J) with also unexpected extension from the current 2 columns to 4 columns.

    If P1 to P6 can be aligned between the 2 sections, then I can use your original formula using INDEX once is enough (and no need for ISERROR) covering the entire range of the 2 sections.

    I appreciate very much of your kind assistance, and indeed learned how to use the functions INDEX / MATCH which I've seen but never used before.

    Thanks a lot.

+ 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. [SOLVED] using Lookup to get values from external workbook, open or closed.
    By JaimeP in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-06-2017, 08:54 AM
  2. Vba button lookup multiple column values from one workbook to another workbook
    By Lorius in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-27-2015, 04:39 PM
  3. Lookup values in one workbook with another
    By Excelrookie_1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-11-2013, 10:09 AM
  4. [SOLVED] Copy Values From Each Workbook in Folder to a Single Sheet in New Workbook +Workbook names
    By Arsham24 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-21-2012, 07:42 PM
  5. lookup for values in another workbook,2 criterias and summarize
    By Randjana in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-19-2008, 02:57 PM
  6. Replies: 4
    Last Post: 04-06-2005, 10:06 PM
  7. Lookup using two values - like an SQL in the same workbook
    By Hall in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-06-2005, 10:06 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