+ Reply to Thread
Results 1 to 12 of 12

copy the frist value then the second etc

  1. #1
    Registered User
    Join Date
    06-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    29

    copy the frist value then the second etc

    so if i have

    A B
    H 1
    M 2
    H 3
    L 4
    M 5
    L 6

    and i want to a cell to look for the first H value and paste then in the cell after that the second H value and paste how do i do it?

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: copy the frist value then the second etc

    Assuming:

    1) Column A is the values to match
    2) Column B is the values to return

    3) D2 holds the value you want to match, "H" in this example
    4) You want a formula in E2 you can copy to the right to get the remaining values that match E2,
    and you can copy down to the next row to match the value in E3, etc...

    Then this ARRAY formula should be put into cell E2:
    =IF(COLUMNS($E:E)>COUNTIF($A:$A, $D2), "", INDEX($B$1:$B$100, SMALL(IF($A$1:$A$100=$D2, ROW($A$1:$A$100), ""), COLUMNS($E:E))))
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    Then copy E2 to the right about 6-10 cells to get the remaining matches. Then copy those cells down rows for other matches to values you enter in D3, D4, etc.

    http://screencast.com/t/vvsUuLk76hIt
    Attached Files Attached Files
    Last edited by JBeaucaire; 07-04-2013 at 09:54 AM. Reason: Attached sample file
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: copy the frist value then the second etc

    Here's another one.

    With your data in the range A2:B7...

    D2 = H

    Enter this array formula** in E2:

    =IFERROR(INDEX(B:B,SMALL(IF(A$2:A$7=D$2,ROW(A$2:A$7)),ROWS(E$2:E2))),"")

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    Copy down until you get blanks.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: copy the frist value then the second etc

    This addition to Jerrys' workbook might be useful.

    Assuming your data in Column A is text and there are no blanks, then Column D extracts the unique values from Column A.
    Attached Files Attached Files
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  5. #5
    Registered User
    Join Date
    06-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: copy the frist value then the second etc

    if i use =VLOOKUP("H",'Day 1'!A11:H29,8,FALSE) i then want it to move on to the next H value

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: copy the frist value then the second etc

    VLOOKUP can't do that.

  7. #7
    Registered User
    Join Date
    06-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: copy the frist value then the second etc

    i have constructed a document to show my use;
    the H, M, L results are randomized over the 20 days (ive only shown 2 days) i need to collate them all on the results page


    run example.xlsx

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: copy the frist value then the second etc

    Just looking at your file ... I can't tell what you're wanting to do.

    How about explaining what results you want and where you want them.

  9. #9
    Registered User
    Join Date
    06-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: copy the frist value then the second etc

    sorry I am struggling to explain slightly

    for instance Day1 H12 needs to go in Results B3
    DAY1 H15 needs to go in Results C3

    hope this is clearer

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: copy the frist value then the second etc

    OK, that helped.

    One more question...

    Will there always be 2 instances of "H" per "run" ? It looks like it in the sample file.

    If so, then you can use a simple VLOOKUP to get the 1st instance and a less complicated formula than what we've suggested in our other replies to get the 2nd instance.

  11. #11
    Registered User
    Join Date
    06-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: copy the frist value then the second etc

    yep always 2 H 2 M and 2 L

    any help on this would be great i have 320 pieces of data i dont really want to use a copy function for them all
    Last edited by josh-mediwatch; 07-05-2013 at 08:44 AM.

  12. #12
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: copy the frist value then the second etc

    Try these...

    Entered in Results B3:

    =VLOOKUP(LEFT(B2),'Day 1'!$A$12:$H$18,8,0)

    Entered in Results C3:

    =LOOKUP(2,1/('Day 1'!A12:A18=LEFT(C2)),'Day 1'!$H$12:$H$18)

    Your data structure is not conducive to easily copying the formulas to the other tables!

    With the current structure it would be possible to come up a single formula that could be copied however that formula would be very complicated and inefficient.

+ 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