+ Reply to Thread
Results 1 to 4 of 4

Combine rows that have the same value in Column A

  1. #1
    Forum Contributor
    Join Date
    04-30-2015
    Location
    The Netherlands
    MS-Off Ver
    office 365
    Posts
    195

    Combine rows that have the same value in Column A

    Hello everyone,

    I'm starting out in Excel VBA but don't really know where to start on this problem. At work we get a report out of the system that is currently not to our liking.

    Excel VBA problem.PNG

    This is an short example of how the report comes out of the system. It is about employees moving to a different housing unit.

    What we want is the following:
    - All rows in the range that are empty should be removed (delete row) (yellow)
    - All the rows that have a value in column A that doesn't match any other row should be removed (it is about people moving from one place to another, if an employee number is only present once, they are only moving out or in, not both) (Orange)
    - The information from columns H, I and J ( The IN columns) should be added to the row that has the OUT information. The row with the IN information should afterwards be removed.

    The result you would get in this case is:

    Excel VBA problem 2.PNG

    Note that in the actual file it can be several hundred lines.

    Attached is the file shown in the images. Thank you for the help in Advance and feel free to ask if anything is unclear.

    Ferdy
    Attached Files Attached Files

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Combine rows that have the same value in Column A

    Try this :-
    This code assumes the "Out" data always comes before the "IN" data

    Please Login or Register  to view this content.
    Regards Mick
    Last edited by MickG; 03-18-2019 at 11:29 AM.

  3. #3
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Combine rows that have the same value in Column A

    Revised Code , forgot about "Orange" cells.
    Please Login or Register  to view this content.
    Regards Mick

  4. #4
    Forum Contributor
    Join Date
    04-30-2015
    Location
    The Netherlands
    MS-Off Ver
    office 365
    Posts
    195

    Re: Combine rows that have the same value in Column A

    Thank you for the response Mick, and sorry for my late reply, been real busy at work.

    The code works perfectly for what we want and luckily more accurate than the manual version they are using currently.

    Thanks a lot!

    Ferdy

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Combine Rows For Duplicates in Column
    By billgyrotech in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-20-2016, 10:11 AM
  2. [SOLVED] VBA - combine matching rows and concatenating corresponding rows into one column
    By mjcanty in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-02-2015, 12:47 PM
  3. Combine multiple rows in column if no value in row before/after
    By oceana_blu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-09-2014, 10:48 PM
  4. [SOLVED] combine several rows to one if column A matches
    By s@skia in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-31-2013, 03:27 AM
  5. Replies: 3
    Last Post: 11-08-2012, 09:29 PM
  6. Replies: 2
    Last Post: 11-08-2012, 06:31 PM
  7. [SOLVED] How to combine rows based on value in column A?
    By ClassicVAG in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 08-03-2012, 06:07 AM

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