Results 1 to 3 of 3

Problem with displaying a date range for leap years

Threaded View

  1. #1
    Registered User
    Join Date
    01-20-2007
    Posts
    3

    Question Problem with displaying a date range for leap years

    Hi,

    I've just finised an interest calculator for my work and have just noticed a small problem before sending it for proofing. The sheet allows the user to select a number of days to calulate interest at a given balance and rate. The actual range is then shown to the right. For example, 5 days of Jan from 1st actually cover 1 Jan - 6 Jan on our system. I've used the following formula for this:
    =IF((C12)>0, DATE(YEAR(0),MONTH(B10),DAY(C12))," ")
    for 1st choice
    =IF((D12)>0,DATE(YEAR(0),MONTH(B10),DAY(D12)+1)," ")
    for 2nd choice. The IF arguement is simply a presentation choice, I don't want anything displayed in the cells unless some data is present.

    Anyway, this all works fine with the exception of February. The sheet allows calculations with a leap year with 29 days. This too works great. However, If I wanted to have a normal calculation of 28 days of Feb and then continue in March, the date range show 1 Feb - 29 Feb instead of 1 Mar - due to the
    DAY(D12)+1 code. So, what I need is for a formula to recognise that the user has selected all the days of Feb and then put in the date range area that it goes to 1 Mar instead of 28+1.

    Something that might be useful: in the calculations involving leap year, I have a checkbox which changes B17 to 29 if checked or leaves it as 28 if not, so the calc for Febs interest is Balance x rate x (no of days / B17). If i could get a formula that says something like:
    IF B17 = D16 (where the end date is) then instead of displaying date +1, display "1 Mar". (would this involve an IF (AND... solutions maybe??)

    Apologies for the convoluted explanation. I've attached a screenshot of the sheet, I can attach the sheet itself if needs be.

    MANY thanks for any replies.
    Regards
    Mike
    Attached Images Attached Images

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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