+ Reply to Thread
Results 1 to 12 of 12

Combining rows if data in certain colums are equal

  1. #1
    Registered User
    Join Date
    07-06-2012
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    34

    Combining rows if data in certain colums are equal

    I'm trying to make this Excel document but I want the AdminTimes for the same LastRxNo to be on the same line. So if the LastRxNo is the same, have one line and the AdminTime column will have multiple values.

    excelquestion.jpg

    Here is a picture of what I want it to look like

    excelquestion2.jpg

    Any ideas? Thanks
    Attached Images Attached Images

  2. #2
    Registered User
    Join Date
    07-06-2012
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Combining rows if data in certain colums are equal

    Anybody able to help?

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,463

    Re: Combining rows if data in certain colums are equal

    Not tested
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    07-06-2012
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Combining rows if data in certain colums are equal

    Is there anything special I need to do with the code? Just go to developer tab and click on Visual Basic and add the code there? Sorry, not too familiar.

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,463

    Re: Combining rows if data in certain colums are equal

    If you go to Visual Basic Editor (VBE)

    Go to [Insert] - [Module] then paste the code on to the right pane and go back to excel.

    When you are in Excel, hit Alt + F8, choose "test" then click on [Run]

  6. #6
    Registered User
    Join Date
    07-06-2012
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Combining rows if data in certain colums are equal

    Okay, I did that and I get a Run-Time error '9': Subscript out of range

    and I hit debug and it references this line of the code

    Sheets(2).Cells(1).Resize(n, UBound(a, 2)).Value = a

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,463

    Re: Combining rows if data in certain colums are equal

    How many worksheets do you have?
    If you have only one worksheet, add one more.

    Otherwise, I need to see your file, (dummy data (the same format) will be fine)

  8. #8
    Registered User
    Join Date
    07-06-2012
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Combining rows if data in certain colums are equal

    Parata Check.xlsx

    This is the modified raw data from the whole document. I just change all the names to be my name. All the data is pulled from a SQL server and is auto refreshed upon opening the document (if that matters).

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,463

    Re: Combining rows if data in certain colums are equal

    OK

    What is the criteria to combine the rows?

  10. #10
    Registered User
    Join Date
    07-06-2012
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Combining rows if data in certain colums are equal

    First I filter out everything in the AdminTime column to show only values with a time (so it will filter out blanks and any words. Then if the value in the LastRxNo equals another LastRxNo the values in the AdminTime fields need to be combined. I could probably filter more out with the SQL query, but this is just all the data I'll need to look at.

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,463

    Re: Combining rows if data in certain colums are equal

    How about this one.
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    07-06-2012
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Combining rows if data in certain colums are equal

    I think that might have done it. I'm going to filter out all of the unwanted results in the admintime with the SQL query, then run that code. I'll let you know how it goes tomorrow. THanks

+ 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