+ Reply to Thread
Results 1 to 16 of 16

Enter Date and Time quick way

  1. #1
    Registered User
    Join Date
    09-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    13

    Enter Date and Time quick way

    Hi, I have four columns with Date, Shift Start time, Shift End time and Hours worked. I have many dates and times to enter but I would like to enter quick way without entering slashes and colons such as if I want to enter 9 September of current year, all I need to enter 909 and I should get "Mon 9 Sep 2013". And if I want to enter date of previous years, all I need to type 7812 and I should get "Tue 7 Aug 2012". For entering times, in Shift Start column I would like to enter 521 and I should get "5:21 PM" and in Shift End column I should get AM instead of PM. In the future, I might would like to change that to AM vice versa. For example AM for Shift Start and PM for Shift End. In Hours column, I would the number of hours worked by counting Shift End minus Shift Start. I can't enter so many dates and times by entering slashes and colons including AM or PM.

    I am open for suggestion if its too short to enter date or time or if its not possible the way I want.

    Thanks in advance.

  2. #2
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Enter Date and Time quick way

    So if you wanted the second of December you would enter:
    212
    and if you wanted the 21st of February you would enter:
    212
    ??
    Gary's Student

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Enter Date and Time quick way

    See this:

    http://www.cpearson.com/Excel/DateTimeEntry.htm
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    09-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    13

    Re: Enter Date and Time quick way

    Jakobshavn, for 21st Feb it should be 2102 and for 9 September it is 909.

    Tony Valko, I have seen that already but I don't know where those scripts goes to in Excel. Also it is American style date and I don't know how to change it to European style. That one looks pretty good though. I wish there was simple way just like entering 090913 should give you 09/09/13. I am okay with that as well.

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

    Re: Enter Date and Time quick way

    090913 would work if
    1 you format the column as text first
    2 enter all your dates in that format
    once done
    select column
    data tab
    text to columns
    next
    next
    choose date and select dmy from the drop down
    click finish
    "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

  6. #6
    Registered User
    Join Date
    09-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    13

    Re: Enter Date and Time quick way

    martindwilson, well for 090913 it didn't work. it worked for 200913. When entering 090913, it omits the initial 0 and becomes 90913 and stays that way. I am still thinking about entrying the quicker way as in cpearson.com. Can someone help me with Date and Time entry from cpearson.com please? I don't know where the code goes.

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

    Re: Enter Date and Time quick way

    you must format column as TEXT FIRST before you enter anything or the leading 0 will disappear
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    09-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    13

    Re: Enter Date and Time quick way

    For date, I decided to format the column to Date and enter the initial date and then increase it by sequential order. So I think I don't need to manually enter every date as they are in sequential numbers anyway. Wish I thought about this earlier. But for shift start and shift finish time it is random numbers so I have to manually enter it in every cell. Now how can I get "5:21 PM" if I enter just 521? I want PM for shift start column and AM for shift end column to be added at the end and then I want to be able to calculate the number of hours worked in another column so I guess it can't be formatted as text as it cannot calculate.

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Enter Date and Time quick way

    Quote Originally Posted by kryptic View Post
    Can someone help me with Date and Time entry from cpearson.com please? I don't know where the code goes.
    Select the sheet where this is to happen.

    Right click the sheet tab and select View Code.

    Paste the code into the window that opens.

    Close the window to return to Excel.

    You will probably have to edit the code to work on your specific range of cells.

    Look for this line of code:


    If Application.Intersect(Target, Range("A1:A10")) Is Nothing Then
    Adjust the Range portion to suit.

  10. #10
    Registered User
    Join Date
    09-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    13

    Re: Enter Date and Time quick way

    That works like a charm. Only thing I have to do is type in 24 hours format to get Am, Pm right which is okay with me. Now which part of code do I need to change to remove the seconds? I just need the hour and minute.

  11. #11
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Enter Date and Time quick way

    Assuming you want the time to display in 12hr format:

    1:15 PM
    1:15 AM
    11:30 PM
    11:30 AM

    Either comment out or delete these lines of the code:

    Please Login or Register  to view this content.
    Change this line of code:

    Please Login or Register  to view this content.
    To:

    Please Login or Register  to view this content.
    Last edited by Tony Valko; 09-15-2013 at 09:37 AM.

  12. #12
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Enter Date and Time quick way

    Here's the code with those changes applied. I also added a line that will clear the cell contents if an invalid time entry is made.

    Please Login or Register  to view this content.
    Change the range address to suit.

  13. #13
    Registered User
    Join Date
    09-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    13

    Re: Enter Date and Time quick way

    Thanks very much. Now I am not able to calculate the number of hours worked from Shift Start and Shift End fields. If the Shift Start is 5:25 PM and Shift End is 4:15 AM, then I should be able to get 8.83 Hrs or 8 Hrs 50 Mins so that I can calculate the amount per hour.

    Is there anyway I can change the code so that when I type in Shift Start, I should get PM only? I tend to type 5 instead of 17 as it is on paper but typing 5 gives me AM. As I quickly type, I cannot think and type whatever is on the paper.
    Last edited by kryptic; 09-17-2013 at 07:09 AM. Reason: added extra line

  14. #14
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Enter Date and Time quick way

    Quote Originally Posted by kryptic View Post
    Thanks very much. Now I am not able to calculate the number of hours worked from Shift Start and Shift End fields. If the Shift Start is 5:25 PM and Shift End is 4:15 AM, then I should be able to get 8.83 Hrs or 8 Hrs 50 Mins so that I can calculate the amount per hour.
    5:25 PM to 4:15 AM is 10hrs 50mins.

    =MOD(end-start,1) formatted as h:mm = 10:50

    =MOD(end-start,1)*24 formatted as General or Number = 10.8333333333

    Is there anyway I can change the code so that when I type in Shift Start, I should get PM only? I tend to type 5 instead of 17 as it is on paper but typing 5 gives me AM. As I quickly type, I cannot think and type whatever is on the paper.
    You can probably do that but I'm not much of a programmer and I don't know how to do it.

  15. #15
    Registered User
    Join Date
    09-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    13

    Re: Enter Date and Time quick way

    I first entered all the shift starts and then shift ends column. That way you know where you are and type the correct time. I was able to quickly enter the times. It saved me a lot of time. Thanks for the help.

  16. #16
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Enter Date and Time quick way

    You're welcome. Thanks for the feedback!

+ 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] automatically enter time & date
    By MUDDER460 in forum Excel General
    Replies: 18
    Last Post: 12-07-2012, 06:49 AM
  2. Macro to automatically enter time & date
    By mellis123 in forum Excel General
    Replies: 6
    Last Post: 06-16-2012, 06:44 AM
  3. Enter date and time
    By akhtar151 in forum Excel General
    Replies: 5
    Last Post: 10-13-2007, 11:25 AM
  4. [SOLVED] Any quick key for entering Current Date and Time?
    By Philip in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-12-2006, 12:25 PM
  5. [SOLVED] Any quick key to insert current Date and Time?
    By Philip in forum Excel General
    Replies: 2
    Last Post: 01-12-2006, 12:20 PM

Tags for this Thread

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