+ Reply to Thread
Results 1 to 11 of 11

Matching debit and credit (accounting)

  1. #1
    Registered User
    Join Date
    12-04-2019
    Location
    Steinkjer, Norway
    MS-Off Ver
    10
    Posts
    6

    Matching debit and credit (accounting)

    Hi and thanks for reading and helping me.


    What I want: A formula that matches debit/credit amounts that sums to 0 on the same account.

    For example:

    account 1500 with amount +100 should be matched with account 1500 amount -100, but not with another +100.


    I have almost solved this problem by reading other threads (thank you very much), but I still have an issue: Similar amounts in credit or debit also get interpreted as "TRUE" when they should not.

    For example:

    account 1500 with amount +110 should be matched with account 1500 amount -110, but not with another +110. Similarly double negative(credit) amounts should not be matched.

    I think the problem is related to the formula using the absolute value, hence not being able to distinguish mathematical signs.

    The formula I am using:


    =SUMPRODUCT(($A$2:$A$999999=$A2)*(ABS($B$2:$B$999999)=ABS($B2)))>1

    Please se my excel-attachment.

    Thank you.
    Attached Files Attached Files

  2. #2
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Matching debit and credit (accounting)

    Try this: =SUMPRODUCT(($A$2:$A$16=A2)*($B$2:$B$16=-B2))>=1
    Click the * to say thanks.

  3. #3
    Registered User
    Join Date
    12-04-2019
    Location
    Steinkjer, Norway
    MS-Off Ver
    10
    Posts
    6

    Re: Matching debit and credit (accounting)

    Thank you for the reply.

    The problem was partially solved, and a new one arose:

    The function does not work if there are more than one amount to match with, see attachment.

    I would like the formula to just pick one of them so the SUM of all true amounts should be 0.


    Side note: There are millions of accountants in the world who could be help with a formula like this - a bit weird that one doesn't exist (?).
    Attached Files Attached Files

  4. #4
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Matching debit and credit (accounting)

    Try this formula:
    =IF(COUNTIFS($B$2:B2,B2,$A$2:A2,A2)>1,FALSE,IF(COUNTIFS($B:$B,-B2,$A:$A,A2)>0,TRUE,FALSE))

  5. #5
    Registered User
    Join Date
    12-04-2019
    Location
    Steinkjer, Norway
    MS-Off Ver
    10
    Posts
    6

    Re: Matching debit and credit (accounting)

    Is something wrong with that formula? I can't paste it inn without getting an error. Im trying to paste it in C2.

  6. #6
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Matching debit and credit (accounting)

    There is nothing wrong with the formula. I used in your sample. What error are you getting?
    I've attached the file as well.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    12-04-2019
    Location
    Steinkjer, Norway
    MS-Off Ver
    10
    Posts
    6

    Re: Matching debit and credit (accounting)

    Ok, some progress. Thank you.

    But if i ad more transactions that should be matched which are similar, the function does not work, see attachment.

    Any solution to this?
    Attached Files Attached Files

  8. #8
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,531

    Re: Matching debit and credit (accounting)

    I am leaving the two helper columns (E:F) in this proposal because they add verification in that you can see in which row the match is established.
    The formulas that populate the helper columns are similar to: =IFERROR(AGGREGATE(15,6,ROW(B$2:B$30)/(B$2:B$30<0)/(B$2:B$30=-B2)/(A$2:A$30=A2),COUNTIFS(B$2:B2,B2)),"")
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  9. #9
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: Matching debit and credit (accounting)

    @Trukjo,

    as you are from Norway, you will probably have to use semicolons ( ; ) instead of commas ( , ) in any formula which uses them as a list separator, which is dependent on your local settings.

    Hope this helps.

    Pete

  10. #10
    Registered User
    Join Date
    12-04-2019
    Location
    Steinkjer, Norway
    MS-Off Ver
    10
    Posts
    6

    Re: Matching debit and credit (accounting)

    Quote Originally Posted by JeteMc View Post
    I am leaving the two helper columns (E:F) in this proposal because they add verification in that you can see in which row the match is established.
    The formulas that populate the helper columns are similar to: =IFERROR(AGGREGATE(15,6,ROW(B$2:B$30)/(B$2:B$30<0)/(B$2:B$30=-B2)/(A$2:A$30=A2),COUNTIFS(B$2:B2,B2)),"")
    Let us know if you have any questions.
    Thank you.

    After testing this formula I discovered it seems to not be able to handle similar numbers on different accounts. See attachment.

    Any solution to this?
    Attached Files Attached Files

  11. #11
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,531

    Re: Matching debit and credit (accounting)

    Try the following:
    For column E: =IFERROR(AGGREGATE(15,6,ROW(B$2:B$50)/(B$2:B$50<0)/(B$2:B$50=-B2)/(A$2:A$50=A2),COUNTIFS(B$2:B2,B2,A$2:A2,A2)),"")
    For column F: =IFERROR(AGGREGATE(15,6,ROW(B$2:B$50)/(B$2:B$50>0)/(B$2:B$50=-B2)/(A$2:A$50=A2),COUNTIFS(B$2:B2,B2,A$2:A2,A2)),"")
    As Pete_UK notes, you may need to use semicolons instead of commas.
    Let us know if you have any questions.

+ 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] Sum debit & Credit Value whre Ref the Same
    By Howardc1001 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-29-2018, 04:27 AM
  2. Debit&Credit
    By meytithveasna in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-20-2017, 09:57 AM
  3. Debit - Credit - Balance
    By CrazynWild in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-11-2014, 08:15 AM
  4. debit-credit
    By tiki33 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-06-2014, 03:13 AM
  5. Debit and Credit Records matching
    By kkoech in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-14-2013, 07:37 AM
  6. Debit credit formulas
    By SAMEEP in forum Excel - New Users/Basics
    Replies: 10
    Last Post: 11-08-2011, 01:13 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