+ Reply to Thread
Results 1 to 5 of 5

consolidate rows based on ID

  1. #1
    Registered User
    Join Date
    11-19-2007
    Posts
    2

    consolidate rows based on ID

    Hi, all. I'm having some difficulty cracking a problem I've encountered. I have a large data set that I have pulled into Excel from a web scraper. I'm looking to consolidate rows but I can't seem to find a command or formula that gives me quite what I want. Here's an example of the situation:

    ID Content Author
    ID0001 Content written by Author #1
    ID0001 Author #1
    ID0002 Content written by Author #2
    ID0002 Author #2
    ID0003 Author #3
    ID0003 Content written by Author #3
    ID0004 Author #4
    ID0004
    ID0004 Content written by Author #4

    I can get rid of the rows where there are no authors or content (Filter and delete), but then I want to consolidate the rows that have the same ID value, so that the content written and the author appear on the same row. The trouble is that the content and the author are not always misaligned in the same direction. Sometimes the author row comes first and sometimes the content row comes first.

    I thought about trying to write a formula that compares ID values across cells and copies the values from the "Content" or "Author" column but I can't wrap my head around how that would look beyond comparing the cells in the ID column and returning a value for true or false.

    Any options that you think I should investigate further?

  2. #2
    Valued Forum Contributor
    Join Date
    02-04-2009
    Location
    Texas
    MS-Off Ver
    Excel 2016
    Posts
    665

    Re: consolidate rows based on ID

    you could first delete the rows with no content written by, or author
    then Sort : by ID - then Content written by
    This will make it look

    A2; ID001 B2: Content Written by ... C2; Blank
    A3: ID001 B3: Blank C3: Author #1


    add new colulumn D with =if(Bx<>"",Cx+1,"") where X is current row and X+1 is the next row number ( B2<>"",C3,"" )
    this will bring the Author up to the row Content written by....

    Then you can copy and paste as value - this will remove formulas - then you can sort on column B (this will group) then delete the rows with Blank column B
    Last edited by CRIMEDOG; 09-01-2017 at 12:21 PM.

  3. #3
    Registered User
    Join Date
    11-19-2007
    Posts
    2

    Re: consolidate rows based on ID

    Brilliant! That works perfectly. It hadn't occurred to me to nest a couple of sort functions first, but once I did, the formula makes perfect sense.

  4. #4
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: consolidate rows based on ID

    If there are only two rows per ID

    Please Login or Register  to view this content.

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: consolidate rows based on ID

    Another way.
    1. Apply Filters.
    2. In "Content" select Blanks.
    3. Select the remaining IDs and delete them.
    4. Clear the filter.
    5. Select column A2:C10
    6. Press Ctrl + G (or the F5 function key).
    7. Click Special.
    8. Select Blanks.
    9. Click OK
    10. Press Ctrl plus the "-" on the numeric keypad. (keyboard short cut for delete cells)
    11. Select Shift cells up.

    It takes longer to read than it does to do it.
    Dave

+ 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. Consolidate duplicate rows based on upper/lowercase
    By Windbrand in forum Excel General
    Replies: 5
    Last Post: 03-17-2017, 12:21 AM
  2. Consolidate Rows of Data Based on Single Column
    By orutulsa in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-17-2014, 09:03 AM
  3. In excel how can I consolidate information in rows based on 2 critera?
    By kevin.willhoit in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-08-2013, 10:52 AM
  4. [SOLVED] Consolidate data in 2 rows into 1 row, based on column criteria
    By PeS in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-22-2012, 11:41 AM
  5. [SOLVED] Consolidate rows with duplicate entries into one row based on some conditions...
    By lifeisaspreadsheet in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 11-04-2012, 12:24 PM
  6. [SOLVED] Consolidate mutiple rows into one row based on ID
    By momozozo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-14-2012, 10:29 PM
  7. Consolidate rows from multiple worksheets in one based on cell criteria
    By SuperSman in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-11-2011, 10:28 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