+ Reply to Thread
Results 1 to 10 of 10

Thread: Keeping 0 in Day

  1. #1
    Registered User
    Join Date
    07-17-2011
    Location
    America
    MS-Off Ver
    Excel 2007
    Posts
    5

    Keeping 0 in Day

    Please advise on what to add to the below string to retain the 0 in the dd field:

    =CONCATENATE(AA2,"GT-H,T2," ",(DAY(AC2&UPPER(TEXT(AC2,"mmm"))&YEAR(AC2)),".pdf"

    Where AC2 is the date (eg. 01JUN2010). The concatenated cells will not retain the 0 in the dd value of AC2.

    James

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    6,176

    Re: Keeping 0 in Day

    Perhapes: instead of AC2 write TEXT(AC2, "00")
    "Relax. What is mind? No matter. What is matter? Never mind!"

  3. #3
    Cheeky Forum Moderator Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2003, 2007, 2010
    Posts
    3,699

    Re: Keeping 0 in Day

    I can't quite figure out what you want the end result of your formula to be,
    but this structure:
    TEXT(AC2,"ddmmmyyyy")

    returns a text string like this: 01Jan2011

    Is that something you can work with?
    Regards,

    Ron
    Microsoft MVP - Excel
    (Oct 2006 - Sep 2012)

    Click here to see the Forum Rules

  4. #4
    Registered User
    Join Date
    07-17-2011
    Location
    America
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Keeping 0 in Day

    I need the date to return with the zero, if the day contains one. So, I need all days to be double digit. And, I need the month to be capitalized (Jun = JUN). When I replace AC2 with TEXT(AC2,"00") I get numbers in the value, for example I get 40330 from 1JUN2010.

  5. #5
    Registered User
    Join Date
    07-15-2011
    Location
    Doha, Qatar
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Keeping 0 in Day

    Go to format cell & select customs and type dd/mm/yyyy or mm/dd/yyyy

    Quote Originally Posted by j2gheart View Post
    I need the date to return with the zero, if the day contains one. So, I need all days to be double digit. And, I need the month to be capitalized (Jun = JUN). When I replace AC2 with TEXT(AC2,"00") I get numbers in the value, for example I get 40330 from 1JUN2010.
    Thanks &Regards


    M H ANSAR

  6. #6
    Registered User
    Join Date
    07-17-2011
    Location
    America
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Keeping 0 in Day

    Quote Originally Posted by ansardoha View Post
    Go to format cell & select customs and type dd/mm/yyyy or mm/dd/yyyy
    That doesn't work in the target cell.

  7. #7
    Cheeky Forum Moderator Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2003, 2007, 2010
    Posts
    3,699

    Re: Keeping 0 in Day

    If you want cell AC2 to display as ddmmmyyyy, that's easy enough using that as a custom number format. However, you won't get AC2 to display as upper case.

    Be aware, though, that changing the format of a referenced cell will have no impact on cells that refer to that cell. For instance, if AC2 contains: =TODAY() formatted as ddmmmyyyy...it will display as: 17Jul2011
    But, this formula: =LEFT(AC2,2) will display 40...not 17, because the underlying value of the cell is the date serial number of 40741.


    If you want your formula to display the date section in upper case,
    just change that section to this:
    UPPER(TEXT(AC2,"ddmmmyyyy"))

    So the entire formula would be something like this:
    =CONCATENATE(AA2,"GT-H",T2," ",UPPER(TEXT(AC2,"ddmmmyyyy")),".pdf")

    or...since CONCATENATE is too much typing for me:
    =AA2&"GT-H"&T2&" "&UPPER(TEXT(AC2,"ddmmmyyyy"))&".pdf"

    Does that help?
    Regards,

    Ron
    Microsoft MVP - Excel
    (Oct 2006 - Sep 2012)

    Click here to see the Forum Rules

  8. #8
    Registered User
    Join Date
    07-17-2011
    Location
    America
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Keeping 0 in Day

    Quote Originally Posted by Ron Coderre View Post
    If you want cell AC2 to display as ddmmmyyyy, that's easy enough using that as a custom number format. However, you won't get AC2 to display as upper case.

    Be aware, though, that changing the format of a referenced cell will have no impact on cells that refer to that cell. For instance, if AC2 contains: =TODAY() formatted as ddmmmyyyy...it will display as: 17Jul2011
    But, this formula: =LEFT(AC2,2) will display 40...not 17, because the underlying value of the cell is the date serial number of 40741.


    If you want your formula to display the date section in upper case,
    just change that section to this:
    UPPER(TEXT(AC2,"ddmmmyyyy"))

    So the entire formula would be something like this:
    =CONCATENATE(AA2,"GT-H",T2," ",UPPER(TEXT(AC2,"ddmmmyyyy")),".pdf")

    or...since CONCATENATE is too much typing for me:
    =AA2&"GT-H"&T2&" "&UPPER(TEXT(AC2,"ddmmmyyyy"))&".pdf"

    Does that help?
    I tried that before and it didn't work. The UPPER formula only applies to letters so when you try to apply it to a string that includes numbers an error occurs.

  9. #9
    Registered User
    Join Date
    07-17-2011
    Location
    America
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Keeping 0 in Day

    I stand corrected, that appears to have worked. Thank you!!

  10. #10
    Cheeky Forum Moderator Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2003, 2007, 2010
    Posts
    3,699

    Re: Keeping 0 in Day

    Quote Originally Posted by j2gheart View Post
    I stand corrected, that appears to have worked. Thank you!!
    You're very welcome...Thanks for the update.
    Regards,

    Ron
    Microsoft MVP - Excel
    (Oct 2006 - Sep 2012)

    Click here to see the Forum Rules

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0