+ Reply to Thread
Results 1 to 6 of 6

Extracting Time from American Date+Time format

  1. #1
    Registered User
    Join Date
    07-09-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    5

    Extracting Time from American Date+Time format

    Hi
    I want to extract time from an American date and time series that I have dumped into excel. I want to use =mod(A1,1), or similar. The problem is, that because I have my excel set to English UK, and this is in American format, every time I get a date such as 04/13/2009 10:30 I get a #value for =mod(A1,1), as I assume that it is interpreting this as '13th month' and is returning an error (when in actual fact the date is 13th of April).

    How can I extract the time regardless of date format?

    thanks very much in advance.

  2. #2
    Valued Forum Contributor
    Join Date
    04-30-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    547

    Re: Extracting Time from American Date+Time format

    Hi,

    if the date is a real date, then the format US/UK does not matter. Format is just cosmetics. If the underlying data value is a number (and every date/time value is a number) then you should be able to run the MOD() function to extract the time.

    Is your date value a real date? Do the test: Format the cell with the "General" format. Does it show as a number similar to this:

    41099.9201388889

    If not, it is not a real date, but most likely text that looks like a date/time value.

    Post a data sample for inspection (in an Excel file, of course)
    Like a post? Click the star below it!

  3. #3
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Extracting Time from American Date+Time format

    use

    =iferror(TIME(HOUR(A1),MINUTE(A1),SECOND(A1)),RIGHT(A1,LEN(A1)-FIND(" ",A1)*1))

    then format cell to "h:mm"
    Last edited by Ace_XL; 07-09-2012 at 06:12 AM.
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Extracting Time from American Date+Time format

    =RIGHT((TEXT(A1,"mm/dd/yyyy hh:mm")),5)+0
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  5. #5
    Registered User
    Join Date
    07-09-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Extracting Time from American Date+Time format

    Thanks very much for your responses. I did the 'text or date' test, and when I changed to general format it still looked like 07/13/2009 10:30 so I assume it is just text? I have now used =right(A1,5) which seems to work fine.

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Extracting Time from American Date+Time format

    no need to test for date the formula i posted works on either

+ 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