+ Reply to Thread
Results 1 to 13 of 13

Sum invoice payments without duplicates

  1. #1
    Registered User
    Join Date
    09-15-2016
    Location
    Vancouver, Canada
    MS-Off Ver
    Office 2016
    Posts
    14

    Sum invoice payments without duplicates

    I am trying to sum up invoice payments. The problem is, each invoice can have several lines with different orders but still have the same invoice #.
    In the amount column, it shows as several payments but realistically they only count as 1.

    For example:
    Inv. Quantity Amount Due
    1234 2 120
    1234 4 120
    1356 4 230
    1895 3 180

    I want the sum total to be 530, not 650.
    How do I do this??

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Sum invoice payments without duplicates

    Hi and welcome to the forum.

    One way with a helper column. In D2 copied down

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


    then sum column D

    Or as an array formula entered with Ctrl-Shift-Enter

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by Richard Buttrey; 09-15-2016 at 07:21 PM.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

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

    Re: Sum invoice payments without duplicates

    This works on your posted sample data.

    Data Range
    A
    B
    C
    D
    E
    1
    Invoice
    Qty
    Amount Due
    Total
    2
    1234
    2
    120
    530
    3
    1234
    4
    120
    4
    1356
    4
    230
    5
    1895
    3
    180
    6
    ------
    ------
    ------
    ------
    ------


    =SUM(IF(FREQUENCY(MATCH(A2:A5,A2:A5,0),ROW(A2:A5)-ROW(A2)+1),C2:C5))

    It will not work if there are duplicate invoice numbers but different amounts due.

    1234...120
    1234...100
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    09-15-2016
    Location
    Vancouver, Canada
    MS-Off Ver
    Office 2016
    Posts
    14

    Re: Sum invoice payments without duplicates

    Thanks for responding! I tried the formula you posted from the data I initially provided but it won't work on my actual data.
    Below is my actual data but. I just copy and pasted the invoice and amount columns but there are about 5 or 6 columns in between them with data.
    As you can see, it is the same concept where there are many duplicate invoice #'s because they have lines with different order information but the amount is still doubled.


    Invoice Amount

    2002311 136.49
    2002314 117.95
    2002314 117.95
    2002315 103.66
    2002315 103.66
    2002316 95.44
    2002323 238.59
    2002324 369.58
    2002324 369.58
    2002325 349.41
    2002325 349.41
    2002325 349.41
    2002326 261.11
    2002326 261.11
    2002326 261.11
    2002326 261.11
    2002329 327.25
    2002331 530.75
    2002331 530.75
    2002331 530.75
    2002338 173.1
    2002339 78.64
    2002339 78.64
    2002340 485.88
    2002340 485.88
    2002340 485.88
    2002341 144.38
    2002342 346.21

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

    Re: Sum invoice payments without duplicates

    With your data in the range A2:B29...

    This formula:

    =SUM(IF(FREQUENCY(MATCH(A2:A29,A2:A29,0),ROW(A2:A29)-ROW(A2)+1),B2:B29))

    Returns 3758.44 which is the correct result.

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Sum invoice payments without duplicates

    Quote Originally Posted by kgkgkg9009 View Post
    Thanks for responding! I tried the formula you posted from the data I initially provided but it won't work on my actual data.
    Below is my actual data but. I just copy and pasted the invoice and amount columns but there are about 5 or 6 columns in between them with data.
    As you can see, it is the same concept where there are many duplicate invoice #'s because they have lines with different order information but the amount is still doubled.
    Hi,

    It's important when you post a question to mention and show all relevant data, and make sure it is at least representative as to layout, otherwise we all spend time devising solutions that won't work on your actual data.
    Your original contained three columns of data all adjacent. This latest shows just two adjacent columns yet you say that there are 5 or 6 columns in between the data.

    If we don't know there are intermediate columns and if even you can't say whether it's 5 or 6 columns how can we possibly know.

    The formulae I gave you WILL work provided you adjust the ranges to reflect your actual data. I'm attaching an example but you'll need to adjust the formula ranges when you've decided where the Invoice and Amount columns actually are.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    09-15-2016
    Location
    Vancouver, Canada
    MS-Off Ver
    Office 2016
    Posts
    14

    Re: Sum invoice payments without duplicates

    Sorry! I'm new to this...still learning the ropes. Thanks for the heads up!

  8. #8
    Registered User
    Join Date
    09-15-2016
    Location
    Vancouver, Canada
    MS-Off Ver
    Office 2016
    Posts
    14

    Re: Sum invoice payments without duplicates

    Quote Originally Posted by Tony Valko View Post
    With your data in the range A2:B29...

    This formula:

    =SUM(IF(FREQUENCY(MATCH(A2:A29,A2:A29,0),ROW(A2:A29)-ROW(A2)+1),B2:B29))

    Returns 3758.44 which is the correct result.
    Thanks for the formula! This worked great except for one thing....
    I noticed that it has to have the exact range every time or it turns up with N/A error.
    I am trying to sum my data as easy as possible so that other people using my database do not have to tweak the formula and change the range every time.
    The range wont be the same every time. It will always start at A2 and B2 but might have more or less data depending on sales that day.

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

    Re: Sum invoice payments without duplicates

    One way is to expand the range to make sure you get all the data.

    =SUM(IF(FREQUENCY(IF(A2:A100<>"",MATCH(A2:A100,A2:A100,0)),ROW(A2:A100)-ROW(A2)+1),B2:B100))

    This formula has to be array entered.

    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.

  10. #10
    Registered User
    Join Date
    09-15-2016
    Location
    Vancouver, Canada
    MS-Off Ver
    Office 2016
    Posts
    14

    Re: Sum invoice payments without duplicates

    Great thanks! That worked.

  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 invoice payments without duplicates

    You're welcome. Thanks for the feedback!

  12. #12
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Sum invoice payments without duplicates

    Try this one. It's shorter and it doesn't need to array entered

    =SUMPRODUCT(1/COUNTIF(A2:A100,A2:A100&"")*B2:B100)

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

    Re: Sum invoice payments without duplicates

    Quote Originally Posted by Teethless mama View Post
    Try this one. It's shorter and it doesn't need to array entered
    And it's also a lot less efficient (slower to calculate).

+ 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] Count invoice numbers, excluding duplicates
    By Nae2016 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-02-2016, 07:52 AM
  2. How to remove duplicates from an invoice using vba
    By SofiaLee in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-10-2015, 03:46 AM
  3. Replies: 1
    Last Post: 06-12-2014, 10:58 AM
  4. Sum Payments on two worksheets after matching the invoice number
    By AMFISH in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-12-2014, 10:36 AM
  5. Removing Duplicates from an invoice table
    By trime in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 05-12-2013, 12:38 AM
  6. VBA Code Request for tracing duplicates on invoice
    By excelvba123 in forum Excel General
    Replies: 2
    Last Post: 05-06-2012, 06:46 AM
  7. How do I forecast future payments by analyzing past payments?
    By CeeBee in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-17-2005, 03:06 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