+ Reply to Thread
Results 1 to 5 of 5

Combining conditional sum and subtotals - Cats and Dogs case?

  1. #1
    Registered User
    Join Date
    09-18-2012
    Location
    Sweden
    MS-Off Ver
    Excel 2003
    Posts
    4

    Combining conditional sum and subtotals - Cats and Dogs case?

    Hello
    I have a formulations problem and would very much appreciate any help.

    In the file attached file TEST.xls there are main objects (Home) and within them there are two other objects (Cats and Dogs). Each of the objects (Home,Cat,Dog) has an area in m and a Home ID.

    My question is to calculate the total sum of area in m taken by cats from all the homes that have cats only and a total sum of area taken by cats from the homes that have both cats and dogs.

    This could be done by combining conditional sum (IF Name = "Cat*" and SUM column "Area" to get total cat area) and subtotal (at each home ID change to get sum of cat and dog areas) functions in Excel. I've spend days trying to make it work.

    The provided example is rather short abbreviation. True files deals with hundreds of "Homes".

    Any suggestions are very much appreciated!

    Regards

    Sebastian

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Combining conditional sum and subtotals - Cats and Dogs case?

    Why is your ID and Home ID always 1 greater than the actual Home ?
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Combining conditional sum and subtotals - Cats and Dogs case?

    Try this

    insert 3 columns after column A
    in B3
    =IF(LEFT(A3,1)="H",A3,B2)
    in C3
    =IF(LEFT(A3,1)="C",A3,"")
    in D3
    =IF(LEFT(A3,1)="D",A3,"")
    and copy down as far as the rows go

    Now use Pivot Tables on those three columns and the Area column

  4. #4
    Registered User
    Join Date
    09-18-2012
    Location
    Sweden
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Combining conditional sum and subtotals - Cats and Dogs case?

    Hello!
    Tanks for reading the post!
    The data set is retrieved as a large tab-delimited.txt from another analysis program calculating area and assigning numbers to objects.
    The program assigns ID to every home so that the other objects (cats and dogs) can be related to in the "Home ID" column.
    The "ID" column can be transposed to the "Home ID" column for simplicity.
    Regards

    Sebastian

  5. #5
    Registered User
    Join Date
    09-18-2012
    Location
    Sweden
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Combining conditional sum and subtotals - Cats and Dogs case?

    Hello Again!
    Thank you for the "Pivot Tables" solution. I tried it and it gave a result similar to running just the "subtotals" function (gives totals for home,dog and cat area for each Home). It does not create sums of two groups (Homes with and without Dogs) of Cat areas. Or maybe I'm implementing it wrong...
    Regards

    Sebastian

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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