Format Result Of Date Difference To 2 Decimal Places

  • Hi All,

    I need a VBA solution only please.

    I use datediff to calculate the difference between 2 dates in Months.

    Result = Datediff("M", Date1,Date2)

    I need the result to be formatted to 2 decimal places ie 23.52 (months)

    Not neccessary to use datediff if this doesnt work.

    Please note I have cross posted this HERE because I couldnt get connected to ozgrid for some reason, I will montior both sites for a solution and post back results. Apologies for the inconvenience.

    As always any help much appreciated and thanks in advance.

  • Re: Format Result Of Date Diff To 2 Decimal Places

    Thanks guys for all your help, from your replys I have developed the following:

    Its part of a function in my spreadsheet and a little differnent but this is the jst of it.

    Thanks for your help, if anyone can see flaws please let me know...

  • Re: Format Result Of Date Difference To 2 Decimal Places

    this function is the same as Gizzmo posted with a modification that takes into account the number of days in the month of date 2 similar to what Reafidy has already posted. but as I was working on it when he replied I thought I will still add my 2 cents worth

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!