+ Reply to Thread
Results 1 to 3 of 3

Convert formatted text to fixed text value (time)

  1. #1
    Registered User
    Join Date
    04-10-2015
    Location
    California
    MS-Off Ver
    2010
    Posts
    1

    Convert formatted text to fixed text value (time)

    I have a report where I use four character time values from a manual text field in our database, for example a field may have been entered 1345 (i.e. 1:45 pm) and excel just registers it as a general/number field. There are a handful of these for each encounter to which I have various formulas and algorithms to compare elapsed time between indicators. There is one timestamp in the database that I also compare to these numbers, however the timestamp is standard excel date/time system, e.g. 13:50:00 PM or 0.576388888888889 as the Excel timevalue. I cant use this in my formulas against the other four character values cause it isn't an apples to apples value, e.g. 0.576388888888889-1345=-1344.42361111111 when I really want 1350-1345=5

    Currently, I custom format the timestamp field to hhmm, then copy and paste it into minitab which strips any backend formatting and then I copy it back into excel and it is in the fixed hhmm format I want with no excel timevalue in the backend.

    Is there a a way to dynamically do this in excel so I dont have to do the minitab roundabout?

  2. #2
    Valued Forum Contributor
    Join Date
    04-12-2012
    Location
    India
    MS-Off Ver
    Excel 2007, 2010, 2013, 2016, 2019, Office 365, Google Spreadhsheet
    Posts
    640

    Re: Convert formatted text to fixed text value (time)

    Hi Steez,

    Welcome to the forum,

    Assuming you have excel date/time format (0.576388888888889) in A1 so then use the following formula in B1 - "=TEXT(A1,"hhmm")" it will return it to 1350 which is what you looking for here..

    If the purpose has been solved, please let me know.
    Thanks,
    Anil Dhawan


    Click *Add Reputation to say "Thanks" and don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved) if you are satisfied.

    Don't stop when you are tired. STOP when you are done!

  3. #3
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Convert formatted text to fixed text value (time)

    I'm not entirely sure that I have all the bases covered here but this seems to work with various time values entered. I have entered decimal numbers, text numbers and real numbers. You don't mention going past 24 hours so I didn't include that.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    A
    B
    C
    1
    Original Time Difference
    2
    1345
    1:45 PM
    3
    0.576389
    1:50 PM
    0:05
    4
    5
    0345
    3:45 AM
    6
    0.456724
    10:57 AM
    7:12
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Convert formatted text to html code
    By merQrey in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-22-2015, 11:12 AM
  2. [SOLVED] Fomula: How to convert a TEXT into a usable time which can be formatted
    By arekkusu03 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 07-17-2013, 08:04 PM
  3. Macro to convert a mutiple sheet workbook to tab delimited text or fixed width text file
    By chandra 2185 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-05-2012, 10:29 AM
  4. Convert Text-Formatted Fraction (4 / 4) to Percent %?
    By WilyTrader in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-02-2010, 02:39 PM
  5. [SOLVED] i have fields that are formatted for text that randomly convert t.
    By dave glynn in forum Excel General
    Replies: 2
    Last Post: 02-22-2005, 05:06 PM

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