+ Reply to Thread
Results 1 to 14 of 14

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

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

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

    Hi,

    I am trying to write a macro for getting payment date against each invoice.

    Eg:
    Invoice Date Inv Value Customer Code Inv_No
    1 Jan 15 100,0000 1 1

    Payment Detials of same customer
    payment Date Amt Customer code Paymentref
    2 Jan 15 950000 1 1
    5 Jan 15 5000 1 2

    In this case i want against first invoice clearing date as 5 jan 2015(since that is the date when the entire amount is cleared.)

    I have two sheets one sheet has Invoice details for all customers and other sheet has payment details for all customers.

    Logic: I want VBA to read each payment line item and then compare whether it belongs to the same customer and if it is then it will compare whether payment value is greater than invoice value if it is TRUE then it will allocate current payment date as clearing date to the invoice selected. Else it will calculate inv_bal and looping will be done to achieve clearing date of each line.

    Here is the code
    Please Login or Register  to view this content.
    Please help me out, it is not working and throwing Run time error '6' Overflow.


    Regards
    Prem
    Last edited by spremkishan; 08-12-2015 at 03:12 AM.

  2. #2
    Forum Contributor
    Join Date
    06-24-2005
    Location
    excelliot.com
    MS-Off Ver
    2007
    Posts
    325

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

    hi

    you need to Add your code between [CODE ]Please Login or Register to view this content.[/CODE] as per forum rule..(Remove spaces between E ]while posting your code)

    Do the needful to get response..

    Cheers!!

  3. #3
    Forum Contributor
    Join Date
    06-24-2005
    Location
    excelliot.com
    MS-Off Ver
    2007
    Posts
    325

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

    Hi

    check this attachment..maintain data as per two sheet & click on blue button to run code:

    updated code is:

    Please Login or Register  to view this content.
    Cheers!!
    Attached Files Attached Files

  4. #4
    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

    Hi Elliot,

    Thanks a ton for your logic, it helped me a lot and saved me from sleepless nights.

    Regards
    Prem.

  5. #5
    Forum Contributor
    Join Date
    06-24-2005
    Location
    excelliot.com
    MS-Off Ver
    2007
    Posts
    325
    Quote Originally Posted by spremkishan View Post
    Hi Elliot,

    Thanks a ton for your logic, it helped me a lot and saved me from sleepless nights.

    Regards
    Prem.
    Great.. mark this as solved.

  6. #6
    Forum Contributor
    Join Date
    06-24-2005
    Location
    excelliot.com
    MS-Off Ver
    2007
    Posts
    325

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

    Hi

    Use this updated code:

    Please Login or Register  to view this content.
    Cheers!!

  7. #7
    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,

    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.

  8. #8
    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.

  9. #9
    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


    Please Login or Register  to view this content.
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    06-24-2005
    Location
    excelliot.com
    MS-Off Ver
    2007
    Posts
    325

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

    where is customer no??

  11. #11
    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

    Quote Originally Posted by excelliot View Post
    where is customer no??
    Column A In Both Invoice and Payments file.

    Regards
    Prem.

  12. #12
    Forum Contributor
    Join Date
    06-24-2005
    Location
    excelliot.com
    MS-Off Ver
    2007
    Posts
    325

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

    Hi

    check this attachment & let me know..

    Cheers!!
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    11-20-2019
    Location
    Greece
    MS-Off Ver
    2010
    Posts
    1

    Re: FIFO_Logic.xlsm

    Hello!!!

    This FIFO_Logic.xlsm does exactly what i was looking for!!!!! i downloaded the file and tested it for hours before i use it.
    Finally i found a small bug that i THINK it has to do with decimals (on integers it works great). I WISH i could send u an attachment that u could see the problem, but i really cant make it for some reason , i got very confused with this
    Can anyone help me on how to send an attachment that i have a small example with the problem?

    Thank you in advance and i am really sorry, its my first day here

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

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

    Administrative Note:

    Hello sparaguak Welcome to Excel Forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread

    As to sending an attachment, the paperclip icon does not work for this website so once you have started your new thread please follow the instructions in the banner at the top of the page that begins "sparaguak Fast answers need clear examples..."

    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ 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