+ Reply to Thread
Results 1 to 4 of 4

Months or Years remaining, formatting

  1. #1
    Registered User
    Join Date
    07-22-2004
    Posts
    89

    Months or Years remaining, formatting

    Hello all.

    =(A1-(NOW()))/365

    The above formula gives me years remaining as "X.XX YEARS" (currently I have the cell formatted as 0.0" years"; )

    This is a two-part question:
    (a) FORMULA CHANGE: I want to change the formula so that the result is the same, UNLESS [LESS THAN 1 YEAR], THEN "X.XX MONTHS"

    (b) FORMATTING METHOD: should i set up a conditional formatting solution, or can I just do this all in one in-cell formula?

    Any help would be much apprecieted.

    - Jim

  2. #2
    Forum Expert swatsp0p's Avatar
    Join Date
    10-07-2004
    Location
    Kentucky, USA
    MS-Off Ver
    Excel 2010
    Posts
    1,545
    Hi James.

    First, Cond. Formatting will not allow you to change the Number format. Only things like font, border and fill patterns can be set via CF.

    Try this: (format your output cell as General)

    =IF((A1-NOW())/365<1,ROUND(((A1-NOW())/365)*12,2)&" Months",ROUND(((A1-NOW())/365),2)&" Years")

    A1=01 July 2006
    Now()=19 Sept 2005
    result= "9.35 Months"

    Does this meet your needs?

    Bruce
    Bruce
    The older I get, the better I used to be.
    USA

  3. #3
    Sandy Mann
    Guest

    Re: Months or Years remaining, formatting

    Try:

    =DATEDIF(A1,TODAY(),"y") & " Years " & DATEDIF(A1,TODAY(),"ym") & " Months"

    DATEDIF is only documented in XL2000 Help but Chip Pearson has a page on his
    website about it:

    http://www.cpearson.com/excel/datedif.htm

    --
    HTH

    Sandy
    [email protected]
    Replace@mailinator with @tiscali.co.uk

    "James C" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello all.
    >
    > =(A1-(NOW()))/365
    >
    > The above formula gives me years remaining as "X.XX YEARS" (currently I
    > have the cell formatted as 0.0" years"; )
    >
    > This is a two-part question:
    > (a) FORMULA CHANGE: I want to change the formula so that the result is
    > the same, UNLESS [LESS THAN 1 YEAR], THEN "X.XX MONTHS"
    >
    > (b) FORMATTING METHOD: should i set up a conditional formatting
    > solution, or can I just do this all in one in-cell formula?
    >
    > Any help would be much apprecieted.
    >
    > - Jim
    >
    >
    > --
    > James C
    > ------------------------------------------------------------------------
    > James C's Profile:
    > http://www.excelforum.com/member.php...o&userid=12114
    > View this thread: http://www.excelforum.com/showthread...hreadid=468843
    >




  4. #4
    Registered User
    Join Date
    07-22-2004
    Posts
    89

    Talking Thanks Much

    Dear Swat and Sandy,

    Thanx much to you both. Swat's worked perfectly. Sandy yours is a nice idea but I have not implemented it as my problem was already solved. Made a note of it for future reference.

    Best Regards,
    - James

+ 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