+ Reply to Thread
Results 1 to 20 of 20

Sum column exclude duplicates

  1. #1
    Registered User
    Join Date
    11-11-2009
    Location
    SC
    MS-Off Ver
    Excel 2003
    Posts
    22

    Sum column exclude duplicates

    I've got data for different regions of our company. For this example, what I need to do is count the number of jobs in the "South Atlantic" region (Column T) that are NOT "Wal-Mart Stores, Inc" jobs. In order to do this, I put a "1" in Column F so that the formula would have something to sum:

    =SUMPRODUCT(--(T2:T1079="SOUTH ATLANTIC"),--(H2:H1079<>"WAL-MART STORES, INC"),(F2:F1079))

    The problem is that some job numbers, which are located in Column G, are duplicated. As a result, this number is higher than it should be.

    So what I need to do is only count each job number once. How do I do that? Is there a way to modify the existing formula? Or do I need something completely different?
    Last edited by ryan@csi; 11-19-2009 at 01:02 PM.

  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: Sum column exclude duplicates

    Maybe:

    =SUM(INDEX(($T$1:$T$1079="SOUTH ATLANTIC") * ($H$1:$H$1079<>"WAL-MART STORES, INC") * (MATCH($F$1:$F$1079, $F$1:$F$1079,0) = ROW($F$1:$F$1079)), 0))

    The range has to be exact, and there can't be any blanks in the F range.
    Last edited by JBeaucaire; 11-13-2009 at 05:40 PM.
    _________________
    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!)

  3. #3
    Registered User
    Join Date
    11-11-2009
    Location
    SC
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Sum column exclude duplicates

    #N/A

    Any ideas?

  4. #4
    Registered User
    Join Date
    11-11-2009
    Location
    SC
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Sum column exclude duplicates

    Would a "CountIF" statement work?

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Sum column exclude duplicates

    Perhaps?

    Please Login or Register  to view this content.
    You don't need the F column if you are adding 1's for each match... just use 1 as the sum value if TRUE...

    Confirmed with CTRL+SHIFT+ENTER

    If you have other values in F, other than 1, to add up, then:

    Please Login or Register  to view this content.
    Last edited by NBVC; 11-16-2009 at 10:29 AM.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  6. #6
    Registered User
    Join Date
    11-11-2009
    Location
    SC
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Sum column exclude duplicates

    Quote Originally Posted by NBVC View Post
    Perhaps?

    Please Login or Register  to view this content.
    You don't need the F column if you are adding 1's for each match... just use 1 as the sum value if TRUE...

    Confirmed with CTRL+SHIFT+ENTER

    If you have other values in F, other than 1, to add up, then:

    Please Login or Register  to view this content.
    it sounds like the first code is what i need. however, i get "#VALUE!" when i enter it. i'm not really advanced enough to follow what the code is doing so i need your help correcting it. thanks ...

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Sum column exclude duplicates

    You need to confirm the formula with CTRL+SHIFT+ENTER keys not just ENTER. When you do that, you should see { } brackets appear around the formula...and hopefully no more error messages...

  8. #8
    Registered User
    Join Date
    11-11-2009
    Location
    SC
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Sum column exclude duplicates

    Worked - thanks!

    I want to be able to use this in future months, so how can I get it to just include the entire column as opposed to just 1 through 1079?

  9. #9
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Sum column exclude duplicates

    You can't use whole column references in 2003 for array formulas like this, so you need to just replace the 1079 with whatever bottom of the range you desire.

    .. but be wary that array formulas don't like large ranges to much, the larger the range and the more array formulas you have the more inefficient and slow the processing becomes...

    ... so try to limit that range to an absolute cell range and not more than you will most likely every need.

  10. #10
    Registered User
    Join Date
    11-11-2009
    Location
    SC
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Sum column exclude duplicates

    OK this should be the last variation ...

    I need to sum the number of different jobs in Column G that have "WAL-MART STORES, INC" in Column H. I figure this can't be much different than what you already provided me with but I can't seem to get it to work.

    Please Login or Register  to view this content.

  11. #11
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Sum column exclude duplicates

    Perhaps?

    Please Login or Register  to view this content.
    confirmed with CSE keys.

  12. #12
    Registered User
    Join Date
    11-11-2009
    Location
    SC
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Sum column exclude duplicates

    I don't think it's working - it seems to be summing all of the jobs. The problem is that some jobs are listed multiple times.

    I've included a "sample" spreadsheet to show you what I'm looking at. Column G has the job numbers while Column H has the Customer Name. There are 10 total jobs but 37 total lines. I need to count up the number of "WAL-MART STORES, INC" jobs, which should be a total of 4. Does that help out any?
    Attached Files Attached Files

  13. #13
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Sum column exclude duplicates

    Try:

    Please Login or Register  to view this content.
    confirmed with CSE keys.

  14. #14
    Registered User
    Join Date
    11-11-2009
    Location
    SC
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Sum column exclude duplicates

    Worked!

    First off, thank you so much for your help. It may not seem like it, but I'm actually learning a lot!

    So how would I adjust this formula if I wanted to do the same thing but include all jobs, not just the Wal-Mart ones?

    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    11-11-2009
    Location
    SC
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Sum column exclude duplicates

    bump for help ...

  16. #16
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Sum column exclude duplicates

    So what is the full requirement now?

  17. #17
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Sum column exclude duplicates

    Maybe?

    Please Login or Register  to view this content.
    confirmed with CSE

  18. #18
    Registered User
    Join Date
    11-11-2009
    Location
    SC
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Sum column exclude duplicates

    The requirement is the same as in Post #12 with one revision - I want to include ALL jobs, not just "Wal-Mart" jobs.

    The formula you provided in Post #13 worked but I just don't know how to change it.

  19. #19
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Sum column exclude duplicates

    See Post # 17 above.

  20. #20
    Registered User
    Join Date
    11-11-2009
    Location
    SC
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Sum column exclude duplicates

    Works! Thanks!!

+ 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