Excel functions calculate the debt age and the average balance
Debt accountants often have to calculate the age of accounts receivable of customers to know which account should be collected first, in addition to calculate the average balance of these receivables to 'improve the quality of financial management. .
Debt accountants often have to calculate the age of accounts receivable of customers to know which account should be collected in advance, in addition to calculate the average balance of these receivables to " improve the quality of financial management. ". If there is no accounting software that provides these functions or has to work with Excel manually, I guarantee you will feel that the life of the accountant is no different from "eternity". The following two Excel functions can help you quickly regain the feeling of love.
For example, we have a customer data sheet as shown below
• The first column is the date of transaction with the customer (sorted by increasing date)
• The second column is the amount of receivables from customers (debiting)
• The third column is the number obtained by the customer (credited)
• The fourth column is the second column except the third column
• The fifth column is balanced and receivable after each transaction, column 6 is a note
Calculations only need columns 1 to 4.
Create function
1. Function OldOfDebt (mRange As Range, toDate As Date) As Double
This function returns the age of the receivables by date, by answering the outstanding receivables at the last day of receivables of which days the principle that the collected amount will be paid for the receivables to first, then calculate the number of days by weight of each item for the balance.
The function has two parameters, the first mRange is the calculation area, in the example is A2: D13; second toDate is the date to determine the age (toDate must be greater than the last day of the transaction with the customer), in the picture is C19. For example, the calculation of the age of accounts receivable is 191,000 and is 146.36 days returned in cell E19.
2. Function AvgBalance (mRange As Range, toDate As Date) As Double
This function has the same parameter as the upper function, returning the average receivable balance of customers by the proportion of time. In the figure, the function calculates the average balance returned to cell E21 is 106.791 with mRange is A2: D13 and toDate is December 31, 2005. (You can calculate the loss that this customer occupies with the interest rate function in the interval A2 to A13).
Source code
Public Function OldOfDebt (mRange As Range, toDate As Date) As Double
Dim rDate As Range Cot now
Dim rDebit As Range Cot recorded no
Dim rCredit As Range Cot record co
Dim mPaid As Double Tong compared to skin
Dim mClose As Double So far, right toDate
Dim mAccDebit As Double Debit cong don
Dim thisAmount As Double
Dim thisDate As Double
Dim mRow As Long Bien
Dim i As Long
Dim ret As Double Click on the link
mRow = mRange.Rows.Count
Set rDate = mRange.Range (Cells (1, 1), Cells (mRow, 1))
Set rDebit = mRange.Range (Cells (1, 2), Cells (mRow, 2))
Set rCredit = mRange.Range (Cells (1, 3), Cells (mRow, 3))
mPaid = Application.WorksheetFunction.Sum (rCredit)
mClose = Application.WorksheetFunction.Sum (rDebit) - Application.WorksheetFunction.Sum (rCredit)
For i = 1 To mRow
If rDebit.Cells (i, 1) .Value <> 0 Then
mAccDebit = mAccDebit + rDebit.Cells (i, 1) .Value
If mAccDebit> mPaid Then
thisAmount = Application.WorksheetFunction.Min (mAccDebit - mPaid, rDebit.Cells (i, 1) .Value)
thisDate = rDate.Cells (i, 1) .Value
ret = ret + thisAmount * (toDate - thisDate) / mClose
End If
End If
Next i
OldOfDebt = ret
End Function
Public Function AvgBalance (mRange As Range, toDate As Date) As Double
Dim rDate As Range
Dim rAmount As Range
Dim mRow As Long
Dim mLenght As Long is busy to work right away
Dim i As Long
Dim ret As Double
mRow = mRange.Rows.Count
Set rDate = mRange.Range (Cells (1, 1), Cells (mRow, 1))
Set rAmount = mRange.Range (Cells (1, 4), Cells (mRow, 4))
mLenght = toDate - rDate.Cells (1, 1)
For i = 1 To mRow
ret = ret + rAmount.Cells (i, 1) * (toDate - rDate.Cells (i, 1)) / mLenght
Next i
AvgBalance = ret
End Function
Nguyen Van Thang
Email : thang_via@yahoo.com
You should read it
- How to Sort Cells Alphabetically in Excel
- How to Lock Cells in Excel
- How to split cells, combine cells in Excel
- Merge cells in Excel
- How to split cells, combine cells (cells) in Word table
- COUNTBLANK function - Count the number of blank (empty) cells in a selected range or array in Excel
- Two new types of blood cells were discovered
- The Match function (the function searches for a specified value in an array or cell range) in Excel
- How to color formula cells in Excel automatically
- The OFFSET function returns a reference in Excel
- How to Remove Spaces Between Characters and Numbers in Excel
- The range () function in Python
Maybe you are interested
How to print two sides of paper in Word, Excel, PDF is extremely simple Instructions for printing two-sided paper in Word, PDF, Excel Watch blocked YouTube videos with a free Chrome extension How to share the screen playing live stream on Facebook Live How many ways to turn off notifications Watched Facebook Messenger messages? Top 10 social networks to replace Facebook (part 2)