Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Combine different lines to display beside each other

  1. #1
    Board Regular
    Join Date
    Aug 2009
    Posts
    140
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Combine different lines to display beside each other

    I am not sure how to ask this question. I want to display two different date fields of data beside each other. They have the same unique serial number/barcode and the dates are on separate lines. I want to display them on the same line beside each other. The first example shows how the data looks. The second shows how I want to display it. How do I move the dates side by side?

    RA_Num BarCode Date_Ent Date_Warranty
    RS07030128 A-236639 7/3/2018 4/5/2019
    RT05240124 A-236639 5/24/2019
    RS12200076 A-325542 12/20/2018 4/15/2019
    RT05290139 A-325542 5/29/2019
    RT04100249 A-334869 4/10/2019 5/21/2019
    RT05280281 A-334869 5/28/2019
    RS08280184 A-335663 8/28/2018 1/31/2019
    RT02060109 A-335663 2/6/2019 3/28/2019
    RT02190119 A-335757 2/19/2019 3/14/2019
    RT03190145 A-335757 3/19/2019 4/22/2019
    RS12280034 A-335780 12/28/2018 3/8/2019
    RT03220089 A-335780 3/22/2019 4/30/2019
    RT03010142 A-336952 3/1/2019 4/29/2019
    RT06050101 A-336952 6/5/2019
    RT01070052 A-358773 1/7/2019 5/28/2019
    RT05280161 A-358773 5/28/2019
    RT01180090 A-360215 1/18/2019 4/26/2019
    RT05020219 A-360215 5/2/2019 5/22/2019
    RS09060234 A-360451 9/6/2018 2/20/2019
    RT03010097 A-360451 3/1/2019 4/18/2019
    RT01300086 A-360666 1/30/2019 4/25/2019
    RT05120051 A-360666 5/12/2019
    RT01210130 A-362214 1/21/2019 4/23/2019
    RT04240052 A-362214 4/24/2019 5/20/2019
    RT05220057 A-362214 5/22/2019


    RA_Num BarCode Date_Ent Date_Warranty
    RS07030128 A-236639 7/3/2018
    RT05240124 A-236639 5/24/2019 4/5/2019
    RS12200076 A-325542 12/20/2018
    RT05290139 A-325542 5/29/2019 4/15/2019
    RT04100249 A-334869 4/10/2019
    RT05280281 A-334869 5/28/2019 5/21/2019
    RS08280184 A-335663 8/28/2018
    RT02060109 A-335663 2/6/2019 1/31/2019
    RT02190119 A-335757 2/19/2019
    RT03190145 A-335757 3/19/2019 3/14/2019
    RS12280034 A-335780 12/28/2018
    RT03220089 A-335780 3/22/2019 3/8/2019
    RT03010142 A-336952 3/1/2019
    RT06050101 A-336952 6/5/2019 4/29/2019
    RT01070052 A-358773 1/7/2019
    RT05280161 A-358773 5/28/2019 5/28/2019
    RT01180090 A-360215 1/18/2019
    RT05020219 A-360215 5/2/2019 4/26/2019
    RS09060234 A-360451 9/6/2018
    RT03010097 A-360451 3/1/2019 2/20/2019
    RT01300086 A-360666 1/30/2019
    RT05120051 A-360666 5/12/2019 4/25/2019
    RT01210130 A-362214 1/21/2019
    RT04240052 A-362214 4/24/2019 4/23/2019
    RT05220057 A-362214 5/22/2019 5/20/2019

  2. #2
    Board Regular
    Join Date
    Feb 2012
    Location
    Florida, USA
    Posts
    11,040
    Post Thanks / Like
    Mentioned
    25 Post(s)
    Tagged
    2 Thread(s)

    Default Re: Combine different lines to display beside each other

    I have no idea which columns and rows your data is in, but if it is in columns A:D and has headers in row 1 with data beginning in row 2, and you have no formulas in column D, the you could simply click on cell D2, right click, choose Delete from the pop up menu and then Shift Up from the options.
    Using Windows 10, Excel 2013.
    Any code provided by me should be tested on a copy or a mock-up of your file before applying it to your original file. Some actions generated by VBA code cannot be reversed with the undo facility in Excel. To open the VB editor, press Alt + F11. To run code from the Excel window, press Alt + F8. Please do not attempt to learn everything about VBA in one thread, especially from me. See this link for attaching images: Attachments

  3. #3
    Board Regular
    Join Date
    Jun 2015
    Location
    Ontario, Canada
    Posts
    1,702
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Combine different lines to display beside each other

    Isn't this the Access forum?
    This would be a tough query to figure out, I think. Thought I had something for a moment then I notice you have barcodes that have 4 dates when at first I thought the 2nd instance of barcode was always going to have no date. IMO, would take some code finagling (an inner and outer loop through a recordset). I can't think of a subquery approach because there is no consistent pattern, such as all 2nd row barcodes are null.

    Another thought is to build a form that has duplicate barcode records and you copy from one field to the other (over-writing one) or do this right in the table field if it's a one time thing

    P.S. - sorry if that first comment seemed snippy. Was not my intention
    Last edited by Micron; Jun 14th, 2019 at 11:53 PM.
    Tips for posting problems:
    1) "doesn't work" doesn't help. Post error message text/numbers and/or state what's happening.
    2) if posting code or sql, use code tags; specify on which code line errors occur, if applicable
    3) try to be specific; assume we know nothing about your issue - because we don't!

    Make all suggested changes in copies of your database or to its objects.

    "1 out of 1010 people understand binary. The other 1001 don't."

  4. #4
    Board Regular
    Join Date
    Aug 2009
    Posts
    140
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Combine different lines to display beside each other

    I am doing this all in Access. It has been a bear to figure out. The loop through a recordset was going to be my next attempt at this. Thanks for the feedback.

  5. #5
    Board Regular
    Join Date
    Feb 2012
    Location
    Florida, USA
    Posts
    11,040
    Post Thanks / Like
    Mentioned
    25 Post(s)
    Tagged
    2 Thread(s)

    Default Re: Combine different lines to display beside each other

    Quote Originally Posted by Tcurtis View Post
    I am doing this all in Access. It has been a bear to figure out. The loop through a recordset was going to be my next attempt at this. Thanks for the feedback.
    Since this is an Excel forum, it would be helpful to know that you are working in a different application at the outset. Access has a different construct to its record set than Excel so data is manipulated by record rather than by rows and columns.
    Using Windows 10, Excel 2013.
    Any code provided by me should be tested on a copy or a mock-up of your file before applying it to your original file. Some actions generated by VBA code cannot be reversed with the undo facility in Excel. To open the VB editor, press Alt + F11. To run code from the Excel window, press Alt + F8. Please do not attempt to learn everything about VBA in one thread, especially from me. See this link for attaching images: Attachments

  6. #6
    Board Regular
    Join Date
    Aug 2009
    Posts
    140
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Combine different lines to display beside each other

    JLFGWhiz, I am sorry, I was under the impression that I was in the Access forum when I posted this. I was in the forum doing a search when I posted this.

  7. #7
    Board Regular
    Join Date
    Jul 2010
    Posts
    449
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Combine different lines to display beside each other

    You were/are in an access forum. JLGWhiz, perhaps you picked this up from the Zero replies which includes posts from all of the forums on this board?

    Tcurtis: I am struggling to work out the logic from your example. each barcode seems to appear in 2 rows on both the first and second data set. is that correct?

  8. #8
    Board Regular
    Join Date
    Feb 2012
    Location
    Florida, USA
    Posts
    11,040
    Post Thanks / Like
    Mentioned
    25 Post(s)
    Tagged
    2 Thread(s)

    Default Re: Combine different lines to display beside each other

    Quote Originally Posted by stumac View Post
    You were/are in an access forum. JLGWhiz, perhaps you picked this up from the Zero replies which includes posts from all of the forums on this board?

    Tcurtis: I am struggling to work out the logic from your example. each barcode seems to appear in 2 rows on both the first and second data set. is that correct?
    Red face! It went completely by me. Of course, I blame it on senility.
    Using Windows 10, Excel 2013.
    Any code provided by me should be tested on a copy or a mock-up of your file before applying it to your original file. Some actions generated by VBA code cannot be reversed with the undo facility in Excel. To open the VB editor, press Alt + F11. To run code from the Excel window, press Alt + F8. Please do not attempt to learn everything about VBA in one thread, especially from me. See this link for attaching images: Attachments

  9. #9
    Board Regular
    Join Date
    Jun 2015
    Location
    Ontario, Canada
    Posts
    1,702
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Combine different lines to display beside each other

    After reviewing my post I see that it could be construed that it was directed to the OP but is wasn't. Whenever I have my doubts I look at the thread cookies at the top to see where the post is. Can save some embarrassment because I did the same thing before (from the unanswered threads page).

    As for the original problem, I have no more suggestions due to the uncertainty I pointed out.

  10. #10
    MrExcel MVP
    Moderator
    xenou's Avatar
    Join Date
    Mar 2007
    Location
    Clev. OH, USA
    Posts
    16,474
    Post Thanks / Like
    Mentioned
    11 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Combine different lines to display beside each other

    I'm waiting for answer to Stumac's question - or in general some more context. The semantics are not clear - why is the second case "right" and the first case "wrong". At first glance it seems you are just filling in a missing value but that's also seems like an insufficient explanation to cover all cases.

    As a rule, with relational databases, you really can't define a problem in terms of "first row, second row" - it has to be defined in terms of the data. You can get something like "first row, second row" solutions by ordering records and dealing with them that way but it's clunky and usually not ideal - for instance, in this case, if you do use ordering, then you are relying on the "first row" always having the data and the "second row" always missing it, which is probably not a good way to approach data.

    Using: Office 2010/Win7 (work) Office 2010/Win7 (home)

    You are rich in proportion to the number of things you can let alone.
    -- Henry David Thoreau

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •