+ Reply to Thread
Results 1 to 6 of 6

Sum and count duplicates in an array

Hybrid View

  1. #1
    Registered User
    Join Date
    05-10-2015
    Location
    Ann Arbor
    MS-Off Ver
    M365
    Posts
    83

    Sum and count duplicates in an array

    Hi All

    I have quite a large data(150K rows) of invoice references and amounts and I've added a conditional format to indicated duplicate references. I'm struggling to get a formula to calculate the total unique number of transactions and amount if he conditional format is "yes" in other words its a duplicate. Grateful if anybody could help.

    Many thanks
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    03-03-2005
    Posts
    316

    Re: Sum and count duplicates in an array

    Try the following array formula


    {=SUM(IF(D5:D13="Yes",C5:C13))}

    Ctl+Shift+Enter



    HTH

  3. #3
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Sum and count duplicates in an array

    Hi
    Use this formula in D5 to see duplicates and copy down
    Formula: copy to clipboard
    =IF(COUNTIF(C$5:C5,C5)>1,"Yes","No")

    Use the following formulas to get the results
    Sum of Amount of Unique Transaction if conditional format is "yes"(duplicate)
    Formula: copy to clipboard
    =SUMIF(D5:D13,"Yes",C5:C13)

    Total number of UniqueTransactions if conditional format is "yes"(duplicate)
    Formula: copy to clipboard
    =COUNTIF(D5:D13,"Yes")

  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 and count duplicates in an array

    Quote Originally Posted by José Augusto View Post
    Use this formula in D5 to see duplicates and copy down
    =IF(COUNTIF(C$5:C5,C5)>1,"Yes","No")
    I have quite a large data(150K rows)
    After you copy that formula to 150,000 rows this is how many cells you're referencing:

    =SUMPRODUCT(ROW(A1:A150000))

    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Microsoft® Excel® for Microsoft 365 MSO (Version 2503 Build 16.0.18604.20000) 64-bit
    Posts
    3,992

    Re: Sum and count duplicates in an array

    Try

    D5=IF(SUMPRODUCT(--($B$5:$B$13&$C$5:$C$13=B5&C5))>1,"Yes","NO")

    J17=SUM(IF(FREQUENCY(IF(D5:D13="Yes",MATCH(B5:B13,B5:B13,0),0),ROW(B5:B13)-ROW(B5)+1)>0,C5:C13,0)) with control+Shift+Enter

    J18=SUM(--(FREQUENCY(IF(D5:D13="Yes",MATCH(B5:B13,B5:B13,0),0),ROW(B5:B13)-ROW(B5)+1)>0)) with control+Shift+Enter.

    Check the attachment.
    Attached Files Attached Files
    If I helped, Don't forget to add reputation (click on the little star ★ at bottom of this post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  6. #6
    Registered User
    Join Date
    05-10-2015
    Location
    Ann Arbor
    MS-Off Ver
    M365
    Posts
    83

    Re: Sum and count duplicates in an array

    Guys, this is awesome! Shukla I used your formula and it works pretty cool. Many thanks.

+ 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. Remove duplicates from array and count number of values
    By JDG94 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-05-2016, 02:02 PM
  2. Replies: 13
    Last Post: 04-19-2015, 11:51 PM
  3. Non-array formula to count non-duplicates
    By Dendrobates in forum Excel General
    Replies: 3
    Last Post: 04-06-2015, 06:30 PM
  4. [SOLVED] Array Formula to count specific text ignoring duplicates.
    By JRidge in forum Excel Formulas & Functions
    Replies: 30
    Last Post: 10-07-2013, 05:31 AM
  5. [SOLVED] Identify Duplicates and Non-Duplicates within an Array (Match)
    By simpson11 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-26-2013, 09:49 AM
  6. Count Duplicates from VBA Array?
    By mfleming in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-06-2011, 09:16 PM
  7. [SOLVED] Count duplicates in an array?
    By quartz in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-05-2005, 10:00 AM

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