+ Reply to Thread
Results 1 to 5 of 5

Thread: Looking for mutiple values

  1. #1
    Registered User
    Join Date
    09-20-2011
    Location
    Belfast
    MS-Off Ver
    Excel 2007
    Posts
    31

    Looking for mutiple values

    I have two sheets in workbook. Sheet 1 has customer name, address etc, in column C is the customer id number.
    Sheet 2 has a list of customers who have used a service, when they used it etc, I can use a Vlookup easy enough when they have only used one service but I need to bring in all instances of that customer.

    I am struggling to articulate this! I have attached an example workbook in the hope that it will become clear!

    What I would like to have Sheet 1 showing:

    D2 = Consultation
    E2 = John
    F2 = 01/01/12
    G2 = Room Hire
    H2 = Sally
    I2 = 05/01/2012
    etc

    D3 = Booking
    E3 = Sally
    F3 = 16/12/11
    etc

    I tried using a macro to find the value of C in sheet 2, resize, copy, paste in sheet 1, re-find and delete entire row. A bit clumsy I know but all I could think of, unfortunately I can't seem to get it to loop through all values of column C.

    Sorry if this is a bit basic.

    Thanks,

    Dean
    Attached Files Attached Files
    Last edited by Dean81; 01-11-2012 at 09:01 AM. Reason: Solved

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

    Re: Looking for mutiple values (I think I am being a bit slow!)

    Try this:

    Add this formula first to D2:

    =COUNTIF(Sheet2!$A$2:$A$7,$C2)

    and copy down

    then in E2

    =IF(COLUMNS($E$1:E$1)/3>$D2,"",INDEX(Sheet2!$B$2:$D$7,SMALL(IF(Sheet2!$A$2:$A$7=$C2,ROW(Sheet2!$B$2:$D$7)-MIN(ROW(Sheet2!$B$2:$D$7))+1),MOD(INT((COLUMNS($E$1:E$1)-1)/3+1)-1,3)+1),MOD(COLUMNS($E$1:E$1)-1,3)+1))
    you must confirm this formula with CTRL+SHIFT+ENTER not just ENTER, then copy across as far as needed and down as far as needed.

    Note: You will need to change all the $7's to correspond to last row in your database range.... you can do that by using Edit|Replace and replace $7 with $(lastrow#).

    Try not to have too many rows though as this is an array formula and is not very efficient....

    You will also need to format the date columns as dates....
    Attached Files Attached Files
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  3. #3
    Registered User
    Join Date
    09-20-2011
    Location
    Belfast
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Looking for mutiple values (I think I am being a bit slow!)

    Holy smoke! That is insane! Thanks so much, I don't think I would have ever got anywhere near that! I will try it now. Thanks again.

    Dean

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

    Re: Looking for mutiple values (I think I am being a bit slow!)

    From PM:

    It's working beautifully for the first 3 instances but when I get to instance number 4 or 5 it goes back to the first one again. Is it currently limited to only find three instances? If so, which of the 3's do I need to change?
    I apologize, I neglected to take into account possibility of more than 3 returns.

    Try changing formula in E2 to:

    =IF(COLUMNS($E1:E1)/3>$D2,"",INDEX(Sheet2!$B$2:$D$7,SMALL(IF(Sheet2!$A$2:$A$7=$C2,ROW(Sheet2!$B$2:$D$7)-MIN(ROW(Sheet2!$B$2:$D$7))+1),MOD(INT((COLUMNS($E$1:E$1)-1)/3+1)-1,$D2)+1),MOD(COLUMNS($E$1:E$1)-1,3)+1))
    Confirmed with CTRL+SHIFT+ENTER not just ENTER.

    copied down and across.
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  5. #5
    Registered User
    Join Date
    09-20-2011
    Location
    Belfast
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Looking for mutiple values (I think I am being a bit slow!)

    Amazing. That's exactly what I needed. Thank you soooooooooo much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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.2.0