+ Reply to Thread
Results 1 to 13 of 13

SUM cells with equal values in an adjacent column.

  1. #1
    Registered User
    Join Date
    12-13-2013
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    15

    SUM cells with equal values in an adjacent column.

    I've attached an image that illustrates what I need to do.

    I need to sum the population of each county (from multiple cells) and each city (from multiple cells), only if there are multiple counties and/ or cities.

    excel-reference-sums.png

    As you can see, Autauga has multiple cities and multiple zip codes. Prattville has multiple zip codes. I want to total the county population, based on the values included in each zip code, and the city populations based on the same criteria.

    If this isn't possible, I may cry. The work I need to do, based on this example is ultra-extensive. I'm looking for shortcuts.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,404

    Re: SUM cells with equal values in an adjacent column.

    Use this in F2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    And use this in G2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    And extend formula down

  3. #3
    Registered User
    Join Date
    12-13-2013
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: SUM cells with equal values in an adjacent column.

    Thank you, zbor!

    Do you know if this formula works in OpenOffice Calc?

    It doesn't seem to.

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,404

    Re: SUM cells with equal values in an adjacent column.

    most common reason being that OpenOffice.org uses semi-colons ( ; ) between arguments, instead of commas ( , ) like in Excel.

    F2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    G2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-13-2013
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: SUM cells with equal values in an adjacent column.

    Using the updated formulas produces a "#NAME?" error.

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,404

    Re: SUM cells with equal values in an adjacent column.

    Both of them?

    try replace them with:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Extend range (1000) if needed

  7. #7
    Registered User
    Join Date
    12-13-2013
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: SUM cells with equal values in an adjacent column.

    Here's an example, with some data.

    http://uscomputerrepair.net/wp-conte...um-example.xls

  8. #8
    Registered User
    Join Date
    12-13-2013
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: SUM cells with equal values in an adjacent column.

    BOOM! That worked!

    Can you explain what you mean by "Extend range (1000) if needed"?

  9. #9
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,404

    Re: SUM cells with equal values in an adjacent column.

    You have quoatation around ranges. Remove them and it will work.

    Also, 2nd formula (in G2) is different than 1st. (See above).
    Attached Files Attached Files

  10. #10
    Forum Guru martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: SUM cells with equal values in an adjacent column.

    =IF(COUNTIF(C$2:C2,C2)=1,SUMIF("c":"c",C2,"e":"e"),"") what is this? where did those quotes come from?
    =IF(COUNTIF(C$2:C2,C2)=1,SUMIF(c:c,C2,e:e),"")
    and while im here open office doesnt support countifs so zbor's sumproduct() is the way to do it
    Last edited by martindwilson; 12-13-2013 at 09:18 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  11. #11
    Registered User
    Join Date
    12-13-2013
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: SUM cells with equal values in an adjacent column.

    This seems to work just the way I need it to. I'm freakin' overjoyed!

    Quote Originally Posted by zbor View Post
    Both of them?

    try replace them with:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Extend range (1000) if needed

  12. #12
    Registered User
    Join Date
    12-13-2013
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: SUM cells with equal values in an adjacent column.

    I really don't know. They weren't in the file I originally saved.

    Quote Originally Posted by martindwilson View Post
    =IF(COUNTIF(C$2:C2,C2)=1,SUMIF("c":"c",C2,"e":"e"),"") what is this? where did those quotes come from?
    =IF(COUNTIF(C$2:C2,C2)=1,SUMIF(c:c,C2,e:e),"")
    and while im here open office doesnt support countifs so zbor's sumproduct() is the way to do it

  13. #13
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365 ProPlus
    Posts
    9,528

    Re: SUM cells with equal values in an adjacent column.

    The VBA alternative would be like this........
    Please Login or Register  to view this content.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

+ 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. Replies: 1
    Last Post: 03-02-2013, 05:06 AM
  2. Average range of cells in column if values in adjacent column are equal
    By RyNye in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-09-2012, 10:12 AM
  3. Replies: 3
    Last Post: 07-30-2012, 11:20 AM
  4. auto merge adjacent cells into one if cell values are equal
    By egosselin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-04-2012, 12:24 AM
  5. autoFill column equal to adjacent column
    By Paulg in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-17-2006, 08:04 AM

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