+ Reply to Thread
Results 1 to 17 of 17

Use Start Date of new Entry as end Date for previous Entry

  1. #1
    Registered User
    Join Date
    06-24-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    88

    Use Start Date of new Entry as end Date for previous Entry

    Hello

    I have a spreadsheet with a Loan statement. (Please see attached sample sheet)

    It has 12 Columns viz. A) Date, B) Receipts, C) Payments, D) Towards, E) Mode, F) Annual Interest Rate, G) Daily Interest Rate, H) Interest Cutoff Date, I) No of Days, J) Interest Amount, K) Closing Principal, L) Closing Interest at the time of that particular entry.

    I have added a Drop down List with options to Column D .....viz. Principal Receipt, Interest, Principal Repaid to define the type of transaction it is. For example Principal Receipt is a Receipt Transaction and the Value will go under Column B) Receipts, Similarly Interest or Principal Repaid will go under Column D) Payments.

    I am trying to achieve following:

    1) When I am entering a new transaction and select "Principal Receipt" option from the drop down list in Column D, then the date of that transaction should be copied to the column H) Interest Cutoff date of the previous transaction with "Principal receipt" in column D.

    2) the "Principal Receipt" amount of that previous entry should be added to the column K) Closing Principal of the new entry.

    3) Similarly, when a "Principal Repaid" option is selected in a new entry, it should deduct the amount from "Closing principal"

    This way, every time a New "Principal /receipt" entry is made, it will work out the interest on previous receipts till the date of new entry and merge the previous receipts with the new receipt to show current closing principal.

    I hope this make sense.

    Please help

    Thanks
    V
    Attached Files Attached Files

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

    Re: Use Start Date of new Entry as end Date for previous Entry

    If I understand correctly the following should do what you want.
    1. Paste the following formula into cell H9 and double click to copy down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    2. Paste the following formula into cell K9 and double click to copy down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Note that it is poor forum etiquette and a violation of Excel Forum rule #5 to double post. Please copy your post in the https://www.excelforum.com/excel-pro...ml#post5109110 thread to this one and ask a moderator to close that thread.
    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.

  3. #3
    Registered User
    Join Date
    06-24-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    88

    Re: Use Start Date of new Entry as end Date for previous Entry

    Hello JeteMc

    Firstly, My sincere apologies for creating confusion with two posts. Its just that, since there were no responses to the first post for a while, I thought may be I wasnt able to explain my problem well. Therefore I tried to break it down to help me re-explain. Could you please guide me on how to copy that post into this one? Thanks

    With the code you have given me, the one I pasted in K9 and down work well, but the one in H9 and down is giving me this error - #NAme?

    Could you please help

    Thanks
    V

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

    Re: Use Start Date of new Entry as end Date for previous Entry

    Sorry, I forgot that the IFNA function is not supported by the 2007 version. Change the formula to read:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    As to copying the post from the other thread select Edit Post (bottom right) then select the post and copy (Ctrl + c). In this thread paste (Ctrl + v) into the next available Quick Reply window. Note that you may have to upload the file again.
    Let us know if you have any questions.

  5. #5
    Registered User
    Join Date
    06-24-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    88

    Re: Use Start Date of new Entry as end Date for previous Entry

    Thanks JeteMc. It worked brilliantly and did exactly what I wanted. Just one more request, is there a way I can clear the contents of the worksheet without loosing the formulae in various cells? May by incorporating a ActivX Command button with a code or something?

    Thanks
    V

  6. #6
    Registered User
    Join Date
    06-24-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    88

    Re: Use Start Date of new Entry as end Date for previous Entry

    Hello

    I have a worksheet where I have used following code to find rows in column D that contain the word "Principal Receipt" and then paste the Date Value from Datepicker into "column H" of the same rows.

    Please Login or Register  to view this content.
    1) This finds ALL the rows containing the word "Principal Receipt" in D and pastes the Date in H. I am wondering, if there is a way I could only get it to paste the Date in H column of ONLY the most recent previous entry with "Capital Receipt" in D, instead of all of them. I mean ONLY in the last entry with "Capital Receipt" in D, prior to the currently entered one.

    2) Also, I have inserted formulae in columns G, I, J, K & L. Is there way I can clear contents of this sheet without loosing the formula I have inserted? My current clear contents code wipes everything clean .

    I have attached the sample workbook for reference.

    Thanks

    V
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    06-24-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    88

    Re: Use Start Date of new Entry as end Date for previous Entry

    I figured it. Created a button to clear first 4 columns with a code and it clears the table ! Thanks

  8. #8
    Registered User
    Join Date
    06-24-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    88

    Re: Use Start Date of new Entry as end Date for previous Entry

    Hi JeteMc

    While the solution you gave me is working exactly as I requested it to be, I have realised a flaw in the logic I was trying to follow.

    I was using start date of the new "Principal Receipt" entry as the cutoff date for the previous "Principal Receipt" entry and adding the balance Principal amount from previous entry to the new one to calculate interest on the entire amount from the date of the new entry.

    However, if a Principal Receipt Entry is made and then after sometime a Principal repaid of equivalent amount is made, then as expected it shows the Balance Principal amount as "0", but it still uses the Interest Cutoff date as either the start date of the next Principal Receipt entry or Today's date if there is no more principal receipt entries. This is affecting the interest calculations dramatically as you would expect.

    For example, If there is Principal Receipt entry on 10 Feb 2019 for $2000 and Principal Re-paid entry for $2000 on 15 March 2019, then the Balance principal becomes "0" on 15 March 2019. Effectively, this should also become the Interest Cutoff date as the Balance Principal is now "0". However, it will only take the next Principal Receipt entry date (if any) as the interest cutoff date or it will take Today's date and in both cases the interest is getting over-calculated.

    Is there a way we can modify the formula to take the Interest Cutoff date for the principal Receipt entry to be either the NEXT Date when the Balance Principal became "0" or the start date of the new entry with "Principal Receipt" in column D , whichever comes first.

    Thanks in advance

    Cheers
    V

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

    Re: Use Start Date of new Entry as end Date for previous Entry

    In the attached file the formula for 'Intertest Cutoff Date' is modified to read:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    06-24-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    88

    Re: Use Start Date of new Entry as end Date for previous Entry

    Hi JeteMc

    Thanks for your response.

    I tried your code / sample sheet you uploaded yesterday. The code seems to work for first two entries, but when I inserted the data for multiple entries, 3rd Principal entry onwards its taking 9 August 2016 (which is the entry date of the very first Principal Receipt entry) as cutoff date to all principal receipt entries. I am attaching the sheet for your reference.

    Could you please help

    Thanks
    V
    Attached Files Attached Files

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

    Re: Use Start Date of new Entry as end Date for previous Entry

    As we are writing formulas for the 2007 version, which does not support AGGREGATE, we will need an array entered formula which needs to be confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.
    The formula is:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    06-24-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    88

    Re: Use Start Date of new Entry as end Date for previous Entry

    Thanks a million JeteMc !! It works brilliantly !! Really appreciate your help !!

    Cheers
    V

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

    Re: Use Start Date of new Entry as end Date for previous Entry

    You're Welcome and thank you for the feedback. Please take a moment to mark the thread as 'Solved' using the thread tools menu above your first post. I hope that you have a blessed day.

  14. #14
    Registered User
    Join Date
    06-24-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    88

    Re: Use Start Date of new Entry as end Date for previous Entry

    Hello JeteMc

    I have stumbled upon one small problem again. Im terribly sorry for not being able to convey all the problems at once, unfortunately I am finding them only as we progress.

    When there is a "Principal Repaid" entry made, it updates the "Balance Principal" from that row onwards which is correct. However, for Interest Calculation purpose, If the Balance principal is not "0", it keeps calculating the interest on the original "Balance Principal" (prior to "Principal repaid" entry effect) until it find either "0" Balance Principal or Next Principal Receipt entry.

    For example,

    10/2/2019 - Principal Entry - 10,000 - Balance Principal is 10,000
    28/2/2019 - Principal Repaid - 5,000 - Balance Principal is 5,000
    31/03/2019 - Principal Reciept - 4,000 - Balance Principal is 9,000

    In above example, ideally it should calculate interest on 10,000 from 10/02/2019 till 28/02/2019 and then on 5,000 from 28/02/2019 till 31/03/2019. And from 31/03/2019 again it will calculate interest on 9,000 which will work correctly.
    The hitch is where the "Principal Repaid" entry is made for a partial amount and Balance Principal is not "0". It continues to calculate interest on the entire Principal Amount without taking into account the Principal Repaid until it finds a "0" balance principal or next Principal Receipt.

    So, basically I think it should take the interest cutoff date as either the next "Principal Repaid" entry or next "Principal Receipt" entry or next "0" Balance principal date. and the "Principal Repaid" entry will also need to have an "Interest Cutoff Date" which will be applicable only if the balance principal is not "0"...i.e. When the "Principal Repaid" entry is made and balance principal is not "0", then the interest cutoff date for that entry will be the next Principal Receipt or next Principal Repaid or "0" capital.

    I hope I was able to explain my problem. I would really appreciate if you could help !

    Thanks again
    V
    Last edited by vikrampnz; 05-04-2019 at 02:58 AM.

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

    Re: Use Start Date of new Entry as end Date for previous Entry

    As the balance only becomes zero if a 'Principal Repaid' entry is made the following array entered formula* seems reasonable and returns results that appear reasonable:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    *Remember to:
    1. Select cell H10 (Ledger sheet)
    2. Paste the formula into the formula bar
    3. Simultaneously press the Ctrl, Shift and Enter keys
    4. Double click the fill handle to copy the formula down.
    Let us know if you have any questions.

  16. #16
    Registered User
    Join Date
    06-24-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    88

    Re: Use Start Date of new Entry as end Date for previous Entry

    Hello JeteMc ........sincere apologies for a much delayed response. Had been travelling extensively. Checked your last code yesterday and it works well !! Thanks again for all your help.

    Cheers
    V

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

    Re: Use Start Date of new Entry as end Date for previous Entry

    You're Welcome and thank you for the feedback. Please take a moment to mark the thread as 'Solved' using the thread tools menu above the first post on either page. I hope that you have a blessed day.

+ 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] If rows has a new entry performs a highlight at the previous entry
    By emina002 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-05-2018, 10:53 PM
  2. Finding Difference to previous entry with new entry
    By joey2point0 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-20-2017, 08:29 PM
  3. change start and end date based on userform entry
    By stoey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-12-2014, 03:56 PM
  4. [SOLVED] Fill End Date with Start date of the next Matching Entry
    By Whraith in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-20-2013, 12:06 AM
  5. [solved]Auto Sequence Date of of previous entry
    By kamelkid2 in forum Excel General
    Replies: 3
    Last Post: 12-15-2011, 10:29 AM
  6. Replies: 2
    Last Post: 09-18-2008, 05:47 AM
  7. automatic erasing of field entry and date entry
    By roadkill in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-24-2008, 10:20 AM

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