+ Reply to Thread
Results 1 to 7 of 7

Vlookup returns Array

  1. #1
    Registered User
    Join Date
    08-29-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2010
    Posts
    10

    Vlookup returns Array

    I've seen a lot of Vlookup and Array questions, but none that work for what I'm doing. I have two worksheets, in worksheet A, Column A has a list of 100 values (many duplicates). In Worksheet B, in Column C is a list of values that match Worksheet A, Column A (no duplicates). In Column E is a list of values.

    What I need a single formula that returns an array Column E values, where Worksheet A: Column A = Worksheet B: Column C. So the end result will be an array of 100 Column E values (many duplicates).

    Example:

    Column A Column C Column E
    Yellow Red 3
    Red Yellow 5
    Yellow Blue 4
    Yellow
    Blue
    Red

    Formula Result: (5;3;5;5;4;3)

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: Vlookup returns Array

    hi blueiris8. might be missing something here, but that's exactly what the VLOOKUP does. so assuming your data starts from A2, try this in Worksheet A, B2:
    =VLOOKUP(A2,Sheet2!$C$2:$E$100,3,0)

    if i'm wrong, do upload a sample Excel file. Make sure there is just enough data to make it clear what is needed. Include BEFORE/AFTER sheets if needed to show the process you're trying to complete or automate. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Registered User
    Join Date
    08-29-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Vlookup returns Array

    Quote Originally Posted by benishiryo View Post
    hi blueiris8. might be missing something here, but that's exactly what the VLOOKUP does. so assuming your data starts from A2, try this in Worksheet A, B2:
    =VLOOKUP(A2,Sheet2!$C$2:$E$100,3,0)

    if i'm wrong, do upload a sample Excel file. Make sure there is just enough data to make it clear what is needed. Include BEFORE/AFTER sheets if needed to show the process you're trying to complete or automate. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Vlookup only returns one value at a time. Instead of looking up A2, I would need A2:A100 in the vlookup (which doesn't work in vlookup). I need a whole array of values. I've seen some Index/Match formulas that were close, but I'm pretty sure Vlookup doesn't work.

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Vlookup returns Array

    You're right, vlookup does not return an array.

    What's the ultimate goal?
    What do you want to actually DO with the resulting array once you have it?
    Do you want to SUM the results?

    In your given examle, is the ultimate result 25 ?

  5. #5
    Registered User
    Join Date
    08-29-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Vlookup returns Array

    Quote Originally Posted by Jonmo1 View Post
    You're right, vlookup does not return an array.

    What's the ultimate goal?
    What do you want to actually DO with the resulting array once you have it?
    Do you want to SUM the results?

    In your given examle, is the ultimate result 25 ?
    I need to concatenate the array with a couple more arrays. I used numbers in the example just be illustrative, I'm actually going after text.

  6. #6
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: Vlookup returns Array

    ok, maybe something like this:
    =SUMIF(Sheet2!C2:C100,A2:A100,Sheet2!E2:E100)

    press F2 on the cell where the formula is & press F9 to calculate. you should see something like this:
    ={5;3;5;5;4;3;0;0;0;.... & so on

    that's probably the best Excel functions can do, unless you want to concatenate cell by cells. otherwise, consider VBA help

  7. #7
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,659

    Re: Vlookup returns Array

    This kind of Lookup should be done with HLOOKUP in combination with MATCH:
    =HLOOKUP("Number",Sheet2!$C$1:$E$4,MATCH($A$2:$A$7,Sheet2!$C$1:$C$4,0),0)

    PHP Code: 
    Sheet1!ColA---Sheet2!ColC-----Sheet2!ColE
    1
    -Color---------- Color---------Number

    2
    -Yellow -------- Red---------    3
    3
    -Red-------------Yellow-----    5
    4
    -Yellow----------Blue-------    4
    5
    -Yellow
    6
    -Blue
    7
    -Red 
    Attached Files Attached Files
    Quang PT

+ 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