+ Reply to Thread
Results 1 to 2 of 2

Merging multiple rows to one row and summing the variables

  1. #1
    Registered User
    Join Date
    02-08-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    1

    Merging multiple rows to one row and summing the variables

    I have some data, a sample of which is attached below.

    case
    1 0 750 0 0 0 0 0 0 0 0 0 0 0
    2 0 0 0 0 0 1500 0 0 0 0 0 0 0
    3 0 0 0 0 0 0 0 0 0 0 0 0 4072
    5 0 0 0 0 0 0 0 0 0 0 0 0 2745
    5 0 0 0 0 0 0 0 0 0 512 0 0 0
    5 0 0 0 0 0 0 0 0 0 0 0 0 1320
    5 0 0 0 0 0 0 0 175 0 0 0 0 0
    5 0 0 0 0 0 0 1760 0 0 0 0 0 0
    5 0 6750 0 0 0 0 0 0 0 0 0 0 0
    6 0 0 0 0 0 0 3760 0 0 0 0 0 0
    6 0 4500 0 0 0 0 0 0 0 0 0 0 0

    What I would like to do is to merge the data such that where there are multiple rows for one case, the data for each column variable is added together so there is a single row for each case.

    I would also like the data to be in numeric order by case and to include the numbers not present such as case 4 with a row of all zeroes. This is in order to merge it with data I have which has cases from 1-5263 with one row for each case representing households. The data above represents people within the households so effectively what I would like to do is aggregate the data to the household level.

    Any help would be much appreciated.

    Thanks

  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: Merging multiple rows to one row and summing the variables

    Better, post an actual workbook with a valid sample data set and mockup of the exact results needed from that sample, BEFORE and AFTER sheets.

    Click GO ADVANCED and use the paperclip icon to post up a copy of your workbook.
    _________________
    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!)

+ 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