+ Reply to Thread
Results 1 to 6 of 6

Vlookup for range

  1. #1
    Registered User
    Join Date
    08-12-2009
    Location
    Perth, WA
    MS-Off Ver
    Excel 2003
    Posts
    93

    Vlookup for range

    Im looking to expand this vlookup so if it doesnt find the value associated with the specific order category that I want returned it will instead retrun an order category according to a defined range say values between 200000-299999.

    =VLOOKUP(A2,D:E,2,FALSE)

    Probably best to view the attached sheet.
    Attached Files Attached Files
    Last edited by hermithead; 03-10-2010 at 10:14 AM.

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

    Re: Vlookup for range

    It is recommended to only use your lower bounds in one column and to list them in ascending order... so the 200000 would be the top followed by 300000 next and so on, then you can use

    =Vlookup(A2,D:E,TRUE)

    If you have to show it as a range 200000-299999, then you still need to place in ascending order and then use something like:

    =INDEX($E$2:$E$44,MATCH(A2,LEFT($D$2:$D$43,6)+0))

    confirmed with CTRL+SHIFT+ENTER not just ENTER...

    notice, that you cannot use whole column references with this type of formula (in XL2003 or earlier)
    Where there is a will there are many ways.

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

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

  3. #3
    Registered User
    Join Date
    08-12-2009
    Location
    Perth, WA
    MS-Off Ver
    Excel 2003
    Posts
    93

    Re: Vlookup for range

    Quote Originally Posted by NBVC View Post
    It is recommended to only use your lower bounds in one column and to list them in ascending order... so the 200000 would be the top followed by 300000 next and so on, then you can use

    =Vlookup(A2,D:E,TRUE)
    Am I missing something or does this only return the value ie 200000 and NOT the number category its supposed to be looking up and returning which should be '0'?
    Last edited by hermithead; 03-10-2010 at 09:18 AM.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Vlookup for range

    See attached for what I mean...
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    08-12-2009
    Location
    Perth, WA
    MS-Off Ver
    Excel 2003
    Posts
    93

    Re: Vlookup for range

    Brilliant! Thanks NBVC I've been looking for this formula for a looooooooooooong time. If you have the time can you explain to me how by using TRUE it returns everything from 200000-299999?

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Vlookup for range

    Per Excel Help on the Function...

    That 4th argument defines what kind of a lookup it will be.. an exact match or an approximate match... FALSE would indicate an EXACT match and the list can be arranged in any order.. only an exact match is searched for... else you will get #N/A error.

    The TRUE indicates to find an approximate match... and it will look for the last value that is smaller than or equal to the search value.. when the search list is in ascending order.

    So anything higher than 200000 but lower than 300000 (say 250000) will default to the 200000 value since it is the last number that is lower than 250000 and not greater.

+ 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