+ Reply to Thread
Results 1 to 17 of 17

Offset a vlookup

  1. #1
    Registered User
    Join Date
    11-30-2006
    Posts
    57

    Offset a vlookup

    is there any way to offset a vlookup formula so that it brings back values other than the first one.

    heres the problem:

    i have a table with customers and the rentals they have made. in the table it has their customer number and then the item code of the item they have rented out.

    i want to have a table that brings up the item codes of what they have rented but with a vlookup it only brings back the first item they have rented and not the ones after that.

  2. #2
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    Is it an offset feature you are after (i.e. you do input the offset number) or a vlookup() function which would return several possibilities ...?
    HTH
    Carim


    Top Excel Links

  3. #3
    Registered User
    Join Date
    11-30-2006
    Posts
    57
    I think it would be a vlookup as each customer will have several rentals and i will need to pick up on all of them.

    It might work as an offset but i dont know how they work so i havent tried

  4. #4
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Why don't you upload a zipped copy of your worksheet ...?

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,721
    Here’s a generic solution.

    Supposing you want to lookup a value in C2 within A2:A10 and return all corresponding values in B2:B10 where there is a match.

    Use this formula in D2

    =IF(COUNTIF(A$2:A$10,C$2)>=ROWS(D$2:D2),INDEX(B$2:B$10,SMALL(IF(A$2:A$10=C$2,ROW(A$2:A$10)-ROW(A$2)+1),ROWS(D$2:D2))),"")

    confirmed with CTRL+SHIFT+ENTER

    copied down as far as you need. Note: it doesn’t matter if you paste the formula down 10 rows when there are only 2 matches, any unneeded cells will remain blank

    Note: to confirm with CTRL+SHIFT+ENTER, paste formula into D2, press F2, hold down CTRL and SHIFT keys and press ENTER at the same time. Curly braces like { and } should appear around the formula in the formula bar and the formula should give the correct result.
    Last edited by daddylonglegs; 02-27-2007 at 09:32 AM.

  6. #6
    Registered User
    Join Date
    11-30-2006
    Posts
    57
    with that formula edited to my spreadsheet i do get other values but not ones with that customer number

    can someone tell me what i need to do to attach the spreadsheet, i havent got anything that will change it to a zip file

  7. #7
    Forum Contributor
    Join Date
    03-14-2006
    Location
    Pakistan
    Posts
    1,791

    Lightbulb

    Quote Originally Posted by Jymoz
    with that formula edited to my spreadsheet i do get other values but not ones with that customer number

    can someone tell me what i need to do to attach the spreadsheet, i havent got anything that will change it to a zip file
    if you use winXP, right click on the file and Send to compressed zipped folder then attach it.

  8. #8
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,721
    Quote Originally Posted by Jymoz
    with that formula edited to my spreadsheet i do get other values but not ones with that customer number

    can someone tell me what i need to do to attach the spreadsheet, i havent got anything that will change it to a zip file
    What formula are you using and in what cell are you starting?

  9. #9
    Registered User
    Join Date
    11-30-2006
    Posts
    57
    Quote Originally Posted by daddylonglegs
    What formula are you using and in what cell are you starting?
    I'm using the =IF(COUNTIF..... formula you gave me

    the number i am looking for is in cell B28 and i am searching for it on another sheet cells B24:C55

    In that table the customer number (what i am searching for) is in column B and the item code (what i want to return) is in column C.

    i'll attach the spreadsheet later as i am unable to do it at the moment

  10. #10
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    Could this previous post help you out ...?
    http://www.excelforum.com/showpost.p...98&postcount=5

  11. #11
    Registered User
    Join Date
    11-30-2006
    Posts
    57
    ok here is the part of my system that is needed for this.

    as you can see i have the table on one page with the customer numbers and the item codes of the items they have rented. On the other page is the lookup where i can only get the first item they have rented
    Attached Files Attached Files

  12. #12
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    See attached ...
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    11-30-2006
    Posts
    57
    hi

    i've finally got it, thanks for all your help on this i really do appreciate it
    Last edited by Jymoz; 03-02-2007 at 05:38 AM.

  14. #14
    Registered User
    Join Date
    11-30-2006
    Posts
    57
    although when trying to put the formula into my sheet there is problem - in the example to gave me there is a { and } at the beginning and end of the formula, which disappear when i change it. It doesnt seem to want to work without these.

    what are they for and what can i do to fix it?

  15. #15
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    To input an array function, use Control Shift Enter instead of Enter ...

  16. #16
    Registered User
    Join Date
    11-30-2006
    Posts
    57
    ahh i see, thanks

  17. #17
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211
    Quote Originally Posted by Jymoz
    is there any way to offset a vlookup formula so that it brings back values other than the first one.

    heres the problem:

    i have a table with customers and the rentals they have made. in the table it has their customer number and then the item code of the item they have rented out.

    i want to have a table that brings up the item codes of what they have rented but with a vlookup it only brings back the first item they have rented and not the ones after that.
    Try Auto Filter

+ 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