+ Reply to Thread
Results 1 to 11 of 11

Vlookup and return value from a range of results?

  1. #1
    Registered User
    Join Date
    01-11-2011
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    6

    Vlookup and return value from a range of results?

    Hi All,

    Would appreciate any help with this dilema.

    Reference Sheet
    Contains the Customer ID, Membership Level and Membership Expiry

    Working Sheet
    Contains the Customer ID, Access Date and Calculation Column.

    Required:
    I am trying to return the Membership Level, for a given Customer, at a particular Access Date (row) from the Reference Sheet.

    The expiry dates in the Reference Sheet is the upper limit. More than one line per customer means their Membership has changed and 31/12/9999 is current.

    I hope this makes sense and please let me know if I need to provide more info.

    Thanks again
    Randy
    Attached Files Attached Files
    Last edited by homer123456; 01-11-2011 at 07:41 PM.

  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 and return value from a range of results?

    Does this work for your needs?

    =LOOKUP(2,1/((REFERENCE!$A$2:$A$13=A2)*(REFERENCE!$C$2:$C$13>=B2)),REFERENCE!$B$2:$B$13)

    copied down
    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
    01-11-2011
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Vlookup and return value from a range of results?

    Thanks NBVC for the quick reply.

    Its not quite there as the formula seems to return only the 'current' Membership Level for all customer dates.

    Customer 3000790344 @ 20/02/09 is returning GVI_GDOM, where I want it to be GVI_09_DOM.

    Reasoning is this customer accessed at 20/02/09, which is after GVI_08_DOM (exp 19/02/09) and during GVI_09_DOM (exp 27/06/09).

    Thanks again =)

  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 and return value from a range of results?

    Does each customer have a 9999 expiry membership?

    If the access date for 3000790344 is after 27/06/09 do you want the GVI_GDOM?

  5. #5
    Registered User
    Join Date
    01-11-2011
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Vlookup and return value from a range of results?

    That's correct, all would have a expiry of 31/12/99. Just like this forum here, they're all members for life =)

    The results I'm hoping for are this:
    EVI_BUS24
    EVI_BUSTR
    EVI_09_E_P
    EVIOB10DAY
    GVI_09_DOM
    EVI_09_HOM
    EVI_09_HOM
    EVI_09_DHP
    EVI_09_DHP

    Thanks

    The WORKING sheet is essentially a log, where it records Customer Access and the membership level that would have been valid at that point in time.
    Last edited by homer123456; 01-11-2011 at 09:40 AM.

  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 and return value from a range of results?

    try:

    =INDEX(REFERENCE!$B$2:$B$13,MATCH(1,INDEX((REFERENCE!$A$2:$A$13=A2)*(REFERENCE!$C$2:$C$13>=B2),0),0))

  7. #7
    Registered User
    Join Date
    01-11-2011
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Vlookup and return value from a range of results?

    Thanks NBVC, it works perfectly on the Example file.

    I am getting a #N/A when I try and replicate this formula to the real spreadsheet Im working on.

    Any tips or things I should know?

    Cheers Randy

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

    Re: Vlookup and return value from a range of results?

    Are there exact matches for each ID (if so, make sure there are no extra spaces, etc that may not make them exact).

    Do all the IDs have a 9999 date.. because the formula is looking for first date over the accessed date for the respective ID, if it doesn't find a date that is larger, then it will return error.

  9. #9
    Registered User
    Join Date
    01-11-2011
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Vlookup and return value from a range of results?

    There are exact matches to all IDs in the REFERENCE sheet and all will have the 9999, just depends on how many they have before that.

    Thanks for your help NBVC, its late here (2am) and I will play with it more at work tomorrow. I know it works on the Sample file, so just need to replicate across.
    PS. My Excel crashed when trying to do this for 50,000 lines lol..
    Last edited by homer123456; 01-11-2011 at 11:15 AM.

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

    Re: Vlookup and return value from a range of results?

    It is an array formula, unfortunately, and array formulas are resource-intensive.

    If there is anyway you can reduce the range from 50000 to the max necessary, it will help.

    I am trying to figure out if it is possible to apply helper columns which would increase the efficiency.... but not sure if it possible given the criteria we are trying to match up...

  11. #11
    Registered User
    Join Date
    01-11-2011
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Vlookup and return value from a range of results?

    Thanks NBVC, you are a Godsend!

    The reason it was returning an #N/A was the MATCH function didnt like Membership ID stored as text on the REFERENCE sheet, eventhough on both sheets they were text. Converted to number and it was fine.

+ 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