+ Reply to Thread
Results 1 to 10 of 10

Vlookup?

  1. #1
    Registered User
    Join Date
    02-01-2017
    Location
    USA
    MS-Off Ver
    2007
    Posts
    5

    Vlookup?

    Hi, I am not sure what formula I need to use. I have a sample of the data below. What formula do I use if I want to look up in column A any value that contains "A111" and I want to pick up the respective values in B and C?


    column A column B column C
    A111-765 round yes
    564 square yes
    14799 rectangle no
    2167 round yes
    A111-76 rectangle yes
    A111-90 rectangle yes
    A112-53 rectangle no




    Here is what I want it to pick up
    A111-765 round yes
    A111-76 rectangle yes
    A111-90 rectangle yes


    Thanks in advance.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Vlookup?

    Hi, and welcome to the forum.

    A Vlookup, indeed any lookup will only return one value. Rather than using lookup you should be using either an Autofilter or an Advanced Filter.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    02-01-2017
    Location
    USA
    MS-Off Ver
    2007
    Posts
    5

    Re: Vlookup?

    Thank you.
    Is there a formula I can use instead? Because my master data will always have new updated rows and I want to create a formula to automatically pick up the new rows

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Vlookup?

    Try this...

    Data Range
    A
    B
    C
    D
    E
    F
    G
    H
    1
    A111-765
    round
    yes
    A111
    A111-765
    round
    yes
    2
    564
    square
    yes
    A111-76
    rectangle
    yes
    3
    14799
    rectangle
    no
    A111-90
    rectangle
    yes
    4
    2167
    round
    yes
    5
    A111-76
    rectangle
    yes
    6
    A111-90
    rectangle
    yes
    7
    A112-53
    rectangle
    no
    8
    ------
    ------
    ------
    ------
    ------
    ------
    ------
    ------


    This array formula** entered in F1:

    =IFERROR(INDEX(A:A,SMALL(IF(ISNUMBER(FIND(E$1,A$1:A$7)),ROW(A$1:A$7)),ROWS(F$1:F1))),"")

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    This formula entered in G1 and copied across to H1:

    =IF($F1="","",VLOOKUP($F1,$A$1:$C$7,COLUMNS($G$1:G$1)+1,0))

    Then, select F1:H1 and copy down until you get blanks.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    02-01-2017
    Location
    USA
    MS-Off Ver
    2007
    Posts
    5

    Re: Vlookup?

    Thank you. Unfortunately, I'm not getting this to work. My master data is in one sheet and I am trying to put the formula in a new tab, so I replaced the A:A with the respective column in my master tab. I received a "0" in my column and when I tried to drag it down, it was all blank.
    When I type in the formula, I need to press CTRL,SHIFT at the same time and then hit ENTER? This is the first time I ever had to do that? Why is that the case?

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Vlookup?

    Quote Originally Posted by annac113 View Post
    When I type in the formula, I need to press CTRL,SHIFT at the same time and then hit ENTER? This is the first time I ever had to do that? Why is that the case?
    Because that formula is an array formula and that's how you have to enter array formulas. For a more specific answer as to why, you'd have to ask Microsoft!

    Here's a small sample file that demonstrates this. I put the raw data on one sheet and the extracted data on another sheet. I also included column headers in the example.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    02-01-2017
    Location
    USA
    MS-Off Ver
    2007
    Posts
    5

    Re: Vlookup?

    Wow thank you!!
    Also, if I were to additional values in column A that were repeats, that would change the vlookup formulas in C and D in the second tab right?
    For example, if I were to add another row:

    A111-765 square no

    Would I not be able to use vlookup formula anymore since there are multiple of the same values in column A?

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Vlookup?

    With duplicate codes like A111-765 VLOOKUP will always find the first instance.

    In that case we can just use the array formula copied across.

    Here's the updated file...
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    02-01-2017
    Location
    USA
    MS-Off Ver
    2007
    Posts
    5

    Re: Vlookup?

    Got it, thank you so much!!

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Vlookup?

    You're welcome. Thanks for the feedback!

+ 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. Replies: 5
    Last Post: 12-07-2016, 09:18 AM
  2. Replies: 3
    Last Post: 12-04-2014, 01:27 PM
  3. Replies: 0
    Last Post: 12-26-2013, 01:12 PM
  4. Display Cell within VLookup range that excel thinks matches the VLookup Value
    By headachexcelperson in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-04-2013, 04:56 PM
  5. vlookup? match? index? MULTIPLE criteria for vlookup search problem....
    By aborg88 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 02-11-2013, 09:56 AM
  6. Replies: 5
    Last Post: 07-29-2009, 07:53 AM
  7. [SOLVED] vlookup function-Can vlookup command find the data from the 5 sheets.
    By Rishab shah in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 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