+ Reply to Thread
Results 1 to 6 of 6

Need help on VLookup to find result based on desired number

  1. #1
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Need help on VLookup to find result based on desired number

    Hello All,
    I'm having a hard time getting a correct VLookup formula to find the result based on desired number. Please take a look at the sample in the attached file and help me out.

    Regards,
    tt3
    Attached Files Attached Files
    Last edited by tuongtu3; 01-16-2013 at 08:54 PM. Reason: Solved

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

    Re: Need help on VLookup to find result based on desired number

    hi tt3. your table is pretty difficult to do a lookup. i did a static one you may have to manually adjust if your columns or requirements change.
    =INDEX(Data!$B$2:$K$8,MATCH(D3,Data!$A$2:$A$8,0),LOOKUP(Y3,{1;25;50;100;250},{2,4,6,8,10}))

    basically the red portion uses Qty in Y to lookup an exact match in these values {1;25;50;100;250}. if it can't find an exact match, it goes to the last biggest value. so for eg. Qty of 150 is no found, so the next biggest value is 100. it will then give me the result vector, which i input as {2,4,6,8,10}. hence, i'll get 8. that is actually the column number i want for my INDEX formula

    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
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: Need help on VLookup to find result based on desired number

    Hi benishiryo,
    1. The correct number at Part7 should be 1 but formula gave number 0.
    2. These values {1;25;50;100;250} in Sheets("Data") will not be the same. It could be any different numbers. When I changed the values (values {1;25;50;100;250}) then the result is wrong.
    Can you take a look and see if you can help. Thank you very much for your time and help.

    Regards,
    tt3

  4. #4
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: Need help on VLookup to find result based on desired number

    hello All,
    Any alternative method/formula to get a right reuslt would be great.

    Regards,
    tt3

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

    Re: Need help on VLookup to find result based on desired number

    try this array formula:
    Please Login or Register  to view this content.
    you have to paste the formula inside the formula bar & press CTRL + SHIFT + ENTER

  6. #6
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: Need help on VLookup to find result based on desired number

    Hi benishiryo,
    The code is perfect as I expect and I'm still thinking how to apply it to my ws.
    Thnak you very much for your time and help.

    regards,
    tt3

+ 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