+ Reply to Thread
Results 1 to 2 of 2

Date subtraction

  1. #1
    Registered User
    Join Date
    11-18-2010
    Location
    Mt. Maunganui, New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    2

    Question Date subtraction

    Hi
    I am trying to convert a function from a VB (version 6.5) macro in Excel 2007 to c#. But there is a date calculation which I don't understand. Can someone please tell me what the following does?

    Please Login or Register  to view this content.
    etc

    Thanks,
    Peter

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Date subtraction

    Hi,

    The user types =CalcRate(date) in Excel, where date is a valid date number.

    The function evaluates two date variables. Dmin1 evaluates to the 1st January for the year containing the date passed, and the Dplus1 evaluates to the 1st January for the following year. So if the date passed is say 13 March 2009, Dmin1 = 1 Jan 2009 and DPlus1 = 1 Jan 2010.

    The B variable takes the number of days between the date passed and the next 1st Jan and divides this by the number of days between 1st Jan in the date year and the 1st Jan in the following year.

    i.e. it's working out the % of the calendar year that's left as a decimal.

    HTH
    Last edited by Richard Buttrey; 11-18-2010 at 08:57 PM.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

+ Reply to Thread

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