+ Reply to Thread
Results 1 to 14 of 14

FIFO Based Receipt Adjustment To determine date when particular invoice is finally cleared

Hybrid View

spremkishan FIFO Based Receipt Adjustment... 08-12-2015, 02:24 AM
excelliot Re: FIFO Based Receipt... 08-12-2015, 02:42 AM
excelliot Re: FIFO Based Receipt... 08-12-2015, 11:20 AM
spremkishan Re: FIFO Based Receipt... 08-12-2015, 12:25 PM
excelliot Great.. mark this as solved. 08-12-2015, 01:36 PM
excelliot Re: FIFO Based Receipt... 08-15-2015, 05:09 AM
spremkishan Re: FIFO Based Receipt... 08-15-2015, 10:55 AM
excelliot upload sample file, with new... 08-15-2015, 11:46 AM
spremkishan Re: FIFO Based Receipt... 08-15-2015, 03:04 PM
excelliot Re: FIFO Based Receipt... 08-16-2015, 03:19 AM
spremkishan Re: FIFO Based Receipt... 08-16-2015, 04:23 AM
excelliot Re: FIFO Based Receipt... 08-17-2015, 05:06 AM
sparaguak Re: FIFO_Logic.xlsm 11-20-2019, 06:49 AM
JeteMc Re: FIFO Based Receipt... 11-22-2019, 08:27 PM
  1. #1
    Forum Contributor
    Join Date
    06-24-2005
    Location
    excelliot.com
    MS-Off Ver
    2007
    Posts
    325
    Quote Originally Posted by spremkishan View Post
    Elloit,

    Logic provided is not working as desired.

    I have sorted file of invoice and payments based on customer and then oldest to newest.
    Now, logic should be in such a way that it will read every payment line, and then it should read first invoice line if customer in payment line is matching with customer as per invoice file then it should compare whether payment amount is greater than zero in that case it should allot current payment line date as clearing date in invoice file. Now it should calculate payment balance and then proceed to next invoice
    In case payment amt is less than invoice amt. it should calculate invoice balance and proceed to next payment.

    Thanks for helping!!.

    Regards
    Prem.
    upload sample file, with new code this should work.

  2. #2
    Registered User
    Join Date
    01-16-2013
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: FIFO Based Receipt Adjustment To determine date when particular invoice is finally cle

    Elloit,

    Here is the Sample File and code below


    Sub fifoadjustment()
    Dim i, j As Long
    Dim Customer As String
    Dim payment_bal, invoice_bal, invoice_amt As Long
    
    
    Sheets("Invoice").Range("L2:L50000").ClearContents
    
    
    payment_bal = 0
    invoice_bal = 0
    invoice_amt = 0
    
    For i = 2 To Sheets("Payments").Range("A70000").End(xlUp).Row
    If payment_bal = 0 Then
    payment_bal = Sheets(2).Range("G" & i).Value
    Else
    payment_bal = payment_bal
    End If
    
    Customer = Sheets(2).Range("A" & i).Value
    
    For j = 2 To Sheets("Invoice").Range("A70000").End(xlUp).Row
        
        If Sheets(1).Range("A" & j) = Customer Then
            If invoice_bal = 0 Then
            invoice_bal = Sheets(1).Range("G" & j).Value
            Else
            invoice_bal = invoice_bal
            End If
        
            If payment_bal >= invoice_bal Then
               Sheets(1).Range("L" & j) = Sheets(2).Range("L" & i)
                payment_bal = payment_bal - invoice_bal
                invoice_bal = 0
                Sheets(2).Range("M" & j).Value = payment_bal
           'GoTo NextInv
            Else
                invoice_bal = invoice_bal - payment_bal
                payment_bal = 0
                GoTo NextPayment
                
            End If
        End If 'need to capture before end if what if customer is not matching in that case it should go to next invoice and next payment
                'hence i have not given any more conditions assuming system will anyway do the same.
                   
    NextInv:
    Next j
    
    
    'Next i should be read only if payment_bal=0 so that iteration will happen for all invoices and allocation will be done
    If payment_bal = 0 Then GoTo NextPayment
    
    NextPayment:
    Next i
    
    End Sub
    Attached Files Attached Files

+ 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] Invoice Description items based on start and end date
    By Learning ExL in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-01-2015, 11:38 AM
  2. [SOLVED] Automatic invoice charges based on date selection
    By Kym-B in forum Excel General
    Replies: 13
    Last Post: 11-21-2013, 01:07 PM
  3. Formula to determine due date based on hire date
    By tastjuste in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-17-2013, 06:59 PM
  4. [SOLVED] Make vlookup reset back to Name or blank after invoice is saved and cleared
    By jfolson in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-05-2013, 08:25 AM
  5. [SOLVED] Determine date based on request date meanwhile falls on particular days
    By Hikari in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 02-18-2013, 09:37 AM
  6. Replies: 4
    Last Post: 11-04-2012, 12:43 PM
  7. Date of Receipt based on In/OUT
    By cmcconna in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-31-2010, 06:47 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