+ Reply to Thread
Results 1 to 10 of 10

Combine vlookup with between...

  1. #1
    Registered User
    Join Date
    03-18-2011
    Location
    Prague, CZ
    MS-Off Ver
    Excel 2003
    Posts
    5

    Combine vlookup with between...

    I'm currently struggling with a formula where I try to combine a vlookup with a value that can be equal or inbetween a list of two values in two columns. This is all based on text strings.

    The lookup should be based on a 3 column sheet:

    TextA | TextC | Textnew1
    TextD | TextG | Textnew2
    TextH | TextM | Textnew3

    When I lookup TextB of another spreadsheet I would like to get 'Textnew1' as a result.

    Anyone has a clue?
    Last edited by Philistine; 03-18-2011 at 11:25 AM. Reason: Solved

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

    Re: Combine vlookup with between...

    If the first column in your table is listed in ascending sorted order, then you can use LOOKUP()

    e.g

    =LOOKUP(A2,H1:J3)

    this will look for the value that is in A2 and try to find it in H1:H3, it will match the last entry that is smaller that or equal to that lookup value and return the item in column J in corresponding row.
    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
    03-18-2011
    Location
    Prague, CZ
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Combine vlookup with between...

    Unfortunately there is no direct match possible.

    TextA - TextC is a range.

    TextB is somewhere inbetween and needs to be detected. If it would be TextA or TextC no prob. I wouldn't need any help.... ;-)

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

    Re: Combine vlookup with between...

    Test my formula...

    with your sample table in H1:J3 and your lookup value of TextB in A1. You should get expected result.

    LOOKUP is an approximate match, not an exact match.

  5. #5
    Registered User
    Join Date
    03-18-2011
    Location
    Prague, CZ
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Combine vlookup with between...

    I get a wonderful #N/A although the range is mapped.

    I have tried
    =LOOKUP(B8,'Sheet1'!A2:B149,'Sheet1'!C2:C149)
    as well as
    =LOOKUP(B8,'Sheet1'!A2:C149)

    In both cases the outcome is #N/A

    I have re-checked the format should be the same, it's all text.

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

    Re: Combine vlookup with between...

    This is what I get with your sample data...

    Can you post a more representable example of your actual data... I am sure it is not as basic as TextA, TextB, TextC
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    03-18-2011
    Location
    Prague, CZ
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Combine vlookup with between...

    Cool! Found my mistake!

    My formula
    =LOOKUP(B8,'Sheet1'!A2:B149,'Sheet1'!C2:C149)

    should have been
    =LOOKUP(B8,'Sheet1'!A2:C149,'Sheet1'!C2:C149)

    Looking into it too long one gets blind....

    Et voila - the result.

    Thanks a million.

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

    Re: Combine vlookup with between...

    In that second case, then you don't actually need the 3rd argument..

    just: =LOOKUP(B8,'Sheet1'!A2:C149) should suffice.

  9. #9
    Registered User
    Join Date
    03-18-2011
    Location
    Prague, CZ
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Combine vlookup with between...

    True, that also works.

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

    Re: Combine vlookup with between...

    Please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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