+ Reply to Thread
Results 1 to 9 of 9

Get time in 24 hrs format from text

  1. #1
    Registered User
    Join Date
    02-16-2013
    Location
    Egypt
    MS-Off Ver
    Excel 2007
    Posts
    12

    Question Get time in 24 hrs format from text

    Hello all,

    I need help please in the attached file.. it's an output of attendance application that returns login time as text without space between numbers and AM or PM ..
    I need a formula or function that can returns me the time in 24hrs formate from that text.
    please find the attached file .. timing.xlsx

    Waiting for your response asap.

    Regards,
    Ahmed Kandil

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,697

    Re: Get time in 24 hrs format from text

    Try this formula in C2

    =REPLACE(B2,LEN(B2)-1,0," ")+0

    format C2 as hh:mm and copy formula down column
    Audere est facere

  3. #3
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Get time in 24 hrs format from text

    Try this formula in column C, and format column C as 24hr time:

    =TIMEVALUE(LEFT(B2,LEN(B2)-2) & " " & RIGHT(B2,2))

  4. #4
    Valued Forum Contributor
    Join Date
    02-05-2013
    Location
    Jakarta, Indonesia
    MS-Off Ver
    Excel 2013
    Posts
    571

    Re: Get time in 24 hrs format from text

    try this (format column as hh:mm):
    Please Login or Register  to view this content.
    if you want the result as text, without change the format column:
    Please Login or Register  to view this content.

    Regards,
    SDCh
    Last edited by SDCh; 02-16-2013 at 11:06 AM.

  5. #5
    Registered User
    Join Date
    02-16-2013
    Location
    Egypt
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Get time in 24 hrs format from text

    Thank you so much guys but i'm sorry I forgot to tell that I want to minimize 2 hours from each time as well

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,697

    Re: Get time in 24 hrs format from text

    Quote Originally Posted by akandl View Post
    ....but i'm sorry I forgot to tell that I want to minimize 2 hours from each time as well
    I don't know what that means - do you mean subtract 2 hours - what results do you expect for your examples?

  7. #7
    Registered User
    Join Date
    02-16-2013
    Location
    Egypt
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Get time in 24 hrs format from text

    Quote Originally Posted by daddylonglegs View Post
    I don't know what that means - do you mean subtract 2 hours - what results do you expect for your examples?
    Yes i want to subtract 2 hrs because the original time in B2 was calculated in different time zone.

    when B2 = 4:00PM then I expect C2 to be = 14:00

  8. #8
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,697

    Re: Get time in 24 hrs format from text

    OK for my version try amending like this

    =MOD(REPLACE(B2,LEN(B2)-1,0," ")-"2:00",1)

    That will work even for times that are 1:12AM (converts to 23:12)

  9. #9
    Registered User
    Join Date
    02-16-2013
    Location
    Egypt
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Get time in 24 hrs format from text

    Quote Originally Posted by daddylonglegs View Post
    OK for my version try amending like this

    =MOD(REPLACE(B2,LEN(B2)-1,0," ")-"2:00",1)

    That will work even for times that are 1:12AM (converts to 23:12)
    thank you so much it works like a charm

+ 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