+ Reply to Thread
Results 1 to 8 of 8

Thread: Lookup from another sheet

  1. #1
    Registered User
    Join Date
    06-05-2009
    Location
    montreal, canada
    MS-Off Ver
    Excel 2003
    Posts
    5

    Lookup from another sheet

    Hi,

    I would like to had a sheet auto populated with values form another sheet based on a column vlaue.

    This is an example of what I would like to achieve:

    SHEET1

    A B C D E
    1 abc Server1 def Y 123
    2 ghi Server3 jkl N 456
    3 mno PC2 opq Y 789
    4 rst PC5 uvw Y 012
    5 cba Server4 fed N 345



    SHEET2
    A
    1 Server1X
    2 Server2X
    3 PC5X

    Sheet 2 should be populated with values from column "B" of sheet1 (and append "X"), if column "D" is = "Y", otherwise ignore and do not add to sheet2.

    I was looking at VLOOKUP, but I don't think that it will work... then again, I'm not that good with formulas.

    there are more columns and rows, and the data is different... just an example.

    can you help? Please no VBA code, only formulas.


    Thank you
    Last edited by NBVC; 02-09-2012 at 04:37 PM.

  2. #2
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: Lookup from another sheet

    Assuming your data is in Sheet1, starting at A1, then in Sheet2 enter formula:

    =LOOKUP(REPT("z",255),CHOOSE({1,2},"",INDEX(Sheet1!$B$1:$B$5,SMALL(IF(Sheet1!$D$1:$D$5="Y",ROW(Sheet1!$D$1:$D$5)-ROW(Sheet1!$D$1)+1),ROWS($A$2:$A2)))&"X"))
    confirmed with CTRL+SHIFT+ENTER not just ENTER and copy down as far as needed.

    Adjust ranges to suit, and reconfirm with CSE keys before copying down again.
    Attached Files Attached Files
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  3. #3
    Valued Forum Contributor
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2007
    Posts
    455

    Re: Lookup from another sheet

    Try this in A1, sheet 2:
    =INDEX(Sheet1!$B$1:$B$5,SMALL(IF(Sheet1!$D$1:$D$5="Y",ROW(INDIRECT("1:"&ROWS($D$1:$D$5))),""),ROW(A1)))&"X"
    Confirmed with Ctrl-Shift-Enter rather than Enter only.
    Copy down till getting error sign.
    Click the star icon in left-corner of my post if you find my post userful!

    Quang PT
    quangphanidico@yahoo.com
    PM me: Y!M: quangphanidico

  4. #4
    Registered User
    Join Date
    06-05-2009
    Location
    montreal, canada
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Lookup from another sheet

    most excellent. I just notice that you uploaded the excel file... Thank you!

    I need to add one more item:
    Instead of adding "X", how can I append the value of the corresponding cell from column "E" of sheet1?

    SHEET2
    A
    1 Server1123
    2 Server2789
    3 PC5012

    thanks

  5. #5
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: Lookup from another sheet

    Try:

    =LOOKUP(REPT("z",255),CHOOSE({1,2},"",INDEX(Sheet1!$B$1:$B$5,SMALL(IF(Sheet1!$D$1:$D$5="Y",ROW(Sheet1!$D$1:$D$5)-ROW(Sheet1!$D$1)+1),ROWS($A$2:$A2)))&INDEX(Sheet1!$E$1:$E$5,SMALL(IF(Sheet1!$D$1:$D$5="Y",ROW(Sheet1!$D$1:$D$5)-ROW(Sheet1!$D$1)+1),ROWS($A$2:$A2)))))
    confirmed with CTRL+SHIFT+ENTER

    note that you have an extra space in column B entries, that will appear in the results..
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  6. #6
    Valued Forum Contributor
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2007
    Posts
    455

    Re: Lookup from another sheet

    @NVBC,
    Is it needed to combine the two INDEX?

    Concanating two ranges together:

    =LOOKUP(REPT("z",255),CHOOSE({1,2},"",INDEX(Sheet1!$B$1:$B$5&Sheet1!$E$1:$E$5,SMALL(IF(Sheet1!$D$1:$D$5="Y",ROW(Sheet1!$D$1:$D$5)-ROW(Sheet1!$D$1)+1),ROWS($A$2:$A2)))))

    keep the formula much shorter!
    Click the star icon in left-corner of my post if you find my post userful!

    Quang PT
    quangphanidico@yahoo.com
    PM me: Y!M: quangphanidico

  7. #7
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: Lookup from another sheet

    Yes, good point. That would be better.
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  8. #8
    Registered User
    Join Date
    06-05-2009
    Location
    montreal, canada
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Lookup from another sheet

    geniuses. thank you

+ 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.2.0