+ Reply to Thread
Results 1 to 18 of 18

Entering Time as HHMM; having it converted to HH:MM

  1. #1
    Registered User
    Join Date
    07-30-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    26

    Entering Time as HHMM; having it converted to HH:MM

    The following problem seems to be solved in this thread: http://www.excelforum.com/excel-gene...11#post3346011 however, I don't seem to be able to get the solution to work.

    "I need to enter elapsed start and stop times (military time, as hours and minutes) into a spreadsheet, for calculations of elapsed time in minutes (calculation used: stop time - start time * 24 * 60).

    I hate having to reach over to enter the colon between the hours and minutes, as it really slows me down (there are 50-60 entries on each spreadsheet I need to do). Does anyone know a way that I can enter the start and stop times without any colons, commas or periods, and still have a calculation performed to provide me with elapsed minutes?"

    Can anyone tell me where you would enter either of these codes? I am trying to achieve the same thing as TC was.

    I have tried entering the code given in Neik Otten's post directly into the VBA in the "ThisWorkbook" object of the spreadsheet I am working on, and this doesn't appear to have done anything.

    I have also tried entering Dav's code in the same place, and these also doesn't appear to have changed anything.

    If anyone could help, I would really appreciate it.

    Apologies if I what I am asking is something very basic!

    Chris

  2. #2
    Forum Contributor
    Join Date
    05-24-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    291

    Re: Entering Time as HHMM; having it converted to HH:MM

    if your time is in HHMM format then you can convert it through below formula

    =TIME(0,RIGHT(A1,2),0)+TIME(LEFT(A1,IF(LEN(A1)=3,1,2)),0,0)

    time in HHMM format in cell A1, then formula to be put in B1 just try & let me know

  3. #3
    Registered User
    Join Date
    07-30-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Entering Time as HHMM; having it converted to HH:MM

    Thanks Amy.

    What I would like, and it is something I have seen done on another spread sheet before, is to be able to enter HHMM into a cell, and for that same cell to be formatted as time. I think someone has solved this issue in the link I gave in my original post, however I am unable to get it to work! Are you able to help with this?

  4. #4
    Forum Contributor
    Join Date
    05-24-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    291

    Re: Entering Time as HHMM; having it converted to HH:MM

    let me chek

  5. #5
    Registered User
    Join Date
    07-30-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Entering Time as HHMM; having it converted to HH:MM

    Thanks again Amy!!

    The person that wants to be able to do this was quite specific in that they want to be able to enter the figure as HHMM in one box, and for that same box to register the entry as time in the format HH:MM

  6. #6
    Forum Contributor
    Join Date
    05-24-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    291

    Re: Entering Time as HHMM; having it converted to HH:MM

    Hi,

    As per your post what I understood is, you have start & end time in HHMM format you need Total hours in HH:MM format by doing (End time ) – (Start time)

    Then Put start time in cell A1 & end time in Cell B1 In HHMM format , & put below formula in cell C1 to get difference in HH:MM format

    =IF(B1="","",TIME(0,RIGHT(B1,2),0)+TIME(LEFT(B1,IF(LEN(B1)=3,1,2)),0,0)-(TIME(0,RIGHT(A1,2),0)+TIME(LEFT(A1,IF(LEN(A1)=3,1,2)),0,0)))

    Note: if your End time is Blank, then it will show Nothing in formula


    i hope this is what you want ....

  7. #7
    Registered User
    Join Date
    07-30-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Entering Time as HHMM; having it converted to HH:MM

    That would work, however it is a spreadsheet that we are looking to send to a client, and my boss is adamant that he wants each entry to register as a time!!!

  8. #8
    Forum Contributor
    Join Date
    05-24-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    291

    Re: Entering Time as HHMM; having it converted to HH:MM

    i am afraid that it is possible...... lets wait for experts to revert on this

  9. #9
    Registered User
    Join Date
    07-30-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Entering Time as HHMM; having it converted to HH:MM

    I think the problem is solved by using VBA in the link I originally gave, I just don't know how to implement the solution!!

  10. #10
    Registered User
    Join Date
    07-30-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Entering Time as HHMM; having it converted to HH:MM

    Is anybody able to help with this? I can send a copy of a spreadsheet that does what I am trying to do, however, I am unable to replicate what it is doing in other spreadsheets. Even copying and pasting the the working spreadsheet, and then adapting it, doesn't work. The working spreadsheet only does what I want it to do in one column.

  11. #11
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Entering Time as HHMM; having it converted to HH:MM

    Is this what you need?

    In Column A the time is entered as a 4 digit text string.

    In Column D the time is entered as a number less than or eqal to 2400., the column is formatted "0000"
    Attached Files Attached Files
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  12. #12
    Registered User
    Join Date
    07-30-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Entering Time as HHMM; having it converted to HH:MM

    Hi Marcol,

    No, in the spreadsheet I have, you enter the time as a 4 digit text string, and then the same cell that you entered the time in displays the time as HH:MM.

    See attached. (Using Active X?)

    Time.xlsm

  13. #13
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Entering Time as HHMM; having it converted to HH:MM

    So what isn't working as required on your sheet?

  14. #14
    Forum Contributor Toonies's Avatar
    Join Date
    07-30-2009
    Location
    Newcastle, UK
    MS-Off Ver
    Excel 2016
    Posts
    511

    Re: Entering Time as HHMM; having it converted to HH:MM

    try this it should work
    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    07-30-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Entering Time as HHMM; having it converted to HH:MM

    Marcol, I can't replicate column E in any other columns on the sheet, or on a different spread sheet.

    Toonies, thanks. How do I enter that?

  16. #16
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Entering Time as HHMM; having it converted to HH:MM

    You will need to define all the ranges where you want your code to work in.

    If you want the code to work in several sheets, and the ranges are the same in every sheet then put the code in the workbook module Workbook_SheetChange event.

    If each sheet is different then the individual sheet modules Worksheet_Change event is where the code should probably go.

  17. #17
    Forum Contributor Toonies's Avatar
    Join Date
    07-30-2009
    Location
    Newcastle, UK
    MS-Off Ver
    Excel 2016
    Posts
    511

    Re: Entering Time as HHMM; having it converted to HH:MM

    Format the columns HH:MM and follow Macrol advise

  18. #18
    Registered User
    Join Date
    07-30-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Entering Time as HHMM; having it converted to HH:MM

    Thanks. That works great.

    For anyone trying to replicate this that is as ignorant as I am:

    (Excel 2010) To enter the code you need to enter the visual basic editor on Excel. This can be done by showing the "Developer" tab on the ribbon, and on the "Developer" tab, selecting Visual Basic.

    In the visual basic editor, in the "project" window that should appear on the left hand side, open the VBAproject/spreadsheet you are working on, open the "Microsoft Excel Objects" folder, and double click "This Workbook".

    In the new window that appears, in the first drop down box, select "Workbook", and in the second drop down box select the appropriate option, as per Marcol's last post.

    In the between the two lines that appeared in the main box, when the option in the second drop down box was selected, copy and paste Toonies code, excluding "Option Explicit
    Private Sub Worksheet_Change(ByVal Target As Range)" at the top of Toonie's code, and "End Sub" at the bottom of his code.

    The code will now be working for "E1:E99" and "F1:F99". To get it to work for other cells, edit references to "E1:E99" and "F1:F99" in the code itself, so that the cells you want the code to work for are referenced.

    Save the visual basic changes.

+ 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. [SOLVED] Entering Time as HHMM; having it converted to HH:MM
    By TC in forum Excel General
    Replies: 7
    Last Post: 08-02-2013, 10:49 AM
  2. Time Formatting - Not able to sum up the time when converted to text format.
    By sagarshinde01 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-08-2013, 11:38 AM
  3. Time elapsed converted to a %
    By eitherorr in forum Excel General
    Replies: 6
    Last Post: 04-28-2011, 06:31 PM
  4. display end time automatically upon entering start time and time usage
    By stoey in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-19-2008, 06:16 PM
  5. Worksheet_Change: Date Time Input [mmddyy hhmm] to [mm/dd/yy hh:mm]
    By Brian Handly in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-31-2005, 12:55 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