+ Reply to Thread
Results 1 to 14 of 14

Sum of values without duplicates

  1. #1
    Registered User
    Join Date
    09-19-2013
    Location
    France
    MS-Off Ver
    Excel 2003
    Posts
    4

    Sum of values without duplicates

    Hi,

    I want to do a sum of values ​​without duplicates. For example, I have an array like this :

    Please Login or Register  to view this content.
    And I want at the end :

    Please Login or Register  to view this content.
    I have try with UNIQUE, COUNTIF, SUM, FILTER, .... but I can't do it

    Have you an idea ?

    Thank you in advance.

    (Sorry for my bad english)

    Yop59

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Sum of values without duplicates

    Hi and welcome to the forum

    assuming your data is in A2:C2, use this in a helper column (I used D2 down)...
    =COUNTIFS($A$2:A2,A2,$C$2:C2,C2)
    then use this to sum, based on the helper...
    =SUMIFS($B$2:$B$9,$D$2:$D$9,1,$A$2:$A$9,F2)
    (I have the choise1 etc in F2:F4)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Sum of values without duplicates

    Hi Yop59,

    Please see attached file.

    You may need to replace "," with ";"
    Attached Files Attached Files
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Sum of values without duplicates

    You want a unique count, not a sum.

    Try this...

    Data Range
    A
    B
    1
    Choice1
    1
    2
    Choice1
    2
    3
    Choice1
    3
    4
    Choice1
    4
    5
    Choice2
    1
    6
    Choice2
    2
    7
    Choice2
    4
    8
    Choice3
    1
    9
    10
    11
    Choice1
    4
    12
    Choice2
    3
    13
    Choice3
    1

    This array formula** entered in B11 and copied down:

    =SUM(IF(FREQUENCY(IF(A$1:A$8=A11,B$1:B$8),B$1:B$8),1))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Sum of values without duplicates

    AlKey, I think you forgot the "TYPE" column?

  6. #6
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Sum of values without duplicates

    Quote Originally Posted by FDibbins View Post
    AlKey, I think you forgot the "TYPE" column?

    Hmm.. result is the same. I looked at what OP's final result is.

  7. #7
    Registered User
    Join Date
    09-19-2013
    Location
    France
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Sum of values without duplicates

    Hi all,

    Thank you for your answers !

    FDibbins, is it possible to have the formula on one line ?

    AlKey and Tony Valko, it's not a COUNT but a SUM taking into consideration the column "Type".

    For example, the Choice1 = 4 because there are 'Choice1 1 one' (without duplicates) and 'Choice1 3 two' (value 1 + value 3 = 4) and not because I have four "Choice1".

    An idea ?

    Thanks

    Yop59
    Last edited by Yop59; 09-19-2013 at 09:02 PM.

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Sum of values without duplicates

    OK, now I understand.

    Try this...

    Data Range
    A
    B
    C
    1
    Choice1
    1
    one
    2
    Choice1
    2
    one
    3
    Choice1
    3
    two
    4
    Choice1
    4
    one
    5
    Choice2
    1
    one
    6
    Choice2
    2
    two
    7
    Choice2
    4
    two
    8
    Choice3
    1
    three
    9
    10
    11
    Choice1
    4
    12
    Choice2
    3
    13
    Choice3
    1

    This array formula** entered in B11 and copied down:

    =SUM(IF(FREQUENCY(IF(A$1:A$8=A11,IF(MATCH(A$1:A$8&C$1:C$8,A$1:A$8&C$1:C$8,0)=ROW(A$1:A$8)-ROW(A$1)+1,ROW(A$1:A$8))),ROW(A$1:A$8)),B$1:B$8))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Last edited by Tony Valko; 09-19-2013 at 09:54 PM. Reason: correct a typo in the formula

  9. #9
    Registered User
    Join Date
    09-19-2013
    Location
    France
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Sum of values without duplicates

    Tony Valko, thank you for your answer but I have an error with your formula (with Google Spreadsheet or LibreOffice Calc).

    Have you an idea why ?

    I have change the "," with ";" or the "A$80" with "A$8".

    (Sorry for all these questions....)

  10. #10
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Sum of values without duplicates

    Deleted post.
    Last edited by AlKey; 09-19-2013 at 09:48 PM.

  11. #11
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Sum of values without duplicates

    Quote Originally Posted by Yop59 View Post
    Tony Valko, thank you for your answer but I have an error with your formula (with Google Spreadsheet or LibreOffice Calc).

    Have you an idea why ?
    I don't know anything about those applications.

    This is an Excel forum!

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Sum of values without duplicates

    No sorry, I'm not sure that they can be combined, but you can always hide the helper column

  13. #13
    Registered User
    Join Date
    09-19-2013
    Location
    France
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Sum of values without duplicates

    Quote Originally Posted by Tony Valko View Post
    OK, now I understand.

    Try this...

    Data Range
    A
    B
    C
    1
    Choice1
    1
    one
    2
    Choice1
    2
    one
    3
    Choice1
    3
    two
    4
    Choice1
    4
    one
    5
    Choice2
    1
    one
    6
    Choice2
    2
    two
    7
    Choice2
    4
    two
    8
    Choice3
    1
    three
    9
    10
    11
    Choice1
    4
    12
    Choice2
    3
    13
    Choice3
    1

    This array formula** entered in B11 and copied down:

    =SUM(IF(FREQUENCY(IF(A$1:A$8=A11,IF(MATCH(A$1:A$8&C$1:C$8,A$1:A$8&C$1:C$8,0)=ROW(A$1:A$8)-ROW(A$1)+1,ROW(A$1:A$8))),ROW(A$1:A$8)),B$1:B$8))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Thank you for your answer Tony Valko (and the others also of course), it works perfectly !!!!

    PS : Sorry for the response time

    Yop59

  14. #14
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Sum of values without duplicates

    You're welcome. Thanks for the feedback!

+ 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. [SOLVED] Macro to find duplicates, concatenate Unique Values, then delete old duplicates
    By lesoies in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-17-2013, 04:32 PM
  2. [SOLVED] Find duplicates in column A, add values from column B (possibly delete duplicates)
    By luarwhite in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-12-2013, 04:34 PM
  3. Replies: 6
    Last Post: 03-29-2012, 12:16 AM
  4. Macro to remove duplicates values and keep unique values bases on multiple criteria
    By Ricker090 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-16-2011, 04:37 PM
  5. Replies: 3
    Last Post: 03-09-2011, 07:00 PM

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