+ Reply to Thread
Results 1 to 4 of 4

How can I get the 'as-displayed' value

  1. #1
    Registered User
    Join Date
    11-07-2003
    Posts
    26

    How can I get the 'as-displayed' value

    Hi,

    I am trying to obtain the "as-displayed" value of a cell (which has a custom format), to be appended to a filename in a 'Saveas' macro.

    Issue:
    Cell "A5" has the custom format of; mmddyyyyhhmm

    My formula in cell "A5" is: =now()

    the result of the above which is 'displayed' in cell A5 is: 031020070841

    Problem:
    Whenever I attempt to extract the "as-displayed" data of cell "A5", I always get the dates serial number as in: 3618335648 or some other form such as 36159.23455 etc.

    Using cell "A10" as a repository for the "as-displayed" data, therein I've tried the formulas of =right(A5,12) and a couple of others, but still not the required result of: 031020070841

    What would you suggest that I try ?

    Thanks

    Jay in Calif.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Jay,

    To capture the "as displayed" cell value, use the Text function. Here is an example...

    A5 formula: =TEXT(Now(), "mmddyyyyhhmm")

    Now when you reference A5's value you will get the formatted text, and not the internal Date-Time numeric value.

    Sincerely,
    Leith Ross

  3. #3
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    How about

    =VALUE(TEXT(A1,"mmddyyyyhhmm"))

    or just =A5 then paste special values

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  4. #4
    Registered User
    Join Date
    11-07-2003
    Posts
    26

    Thanks all :-)

    The formula provided by Leith provides the desired result :-)

    The formula provide by VBA Noob produces an exponential result. (assuming A5 initially contained the formula =now(), and the second suggestion of 'paste special' produces the date/time format in decimal, like: 35189.34566

    Thanks to both of you for your responses, both of which helps us all to learn.

    Jay

+ 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