+ Reply to Thread
Results 1 to 12 of 12

Looking for solution to date and time problem

  1. #1
    Registered User
    Join Date
    02-02-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    6

    Looking for solution to date and time problem

    Hello, I need some help with a little problem I'm having. I have a report that I get once a week and I would like to be able to get a value for the difference in time between two cells. The problem is that this is how the data is placed in the cell.

    1/29/2014 12:45:00 AM
    1/29/2014 12:48:00 AM
    1/29/2014 12:53:00 AM
    1/29/2014 1:07:00 AM

    So because it's done as both date and time in one cell it won't let me get a serial number for the time so I can do a subtraction and find the difference. Any ideas on this one?

    THanks,
    Last edited by budica; 02-09-2014 at 12:17 AM. Reason: Solved

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Looking for solution to date and time problem

    Hi and welcome to the forum

    You need to understand how excel handles dates and times, to figure this out (and its really not that hard)

    dates are really just 5-digit numbers representing how many days have passed since 1/1/1900, excel formats them so we recognose dates
    Time is a decimal of 1 (day), so 6:00 Am is actually 0.25, 12 noon is 0.5 and so on

    So with those date/times above, you should be able to just run the calc, and then format as number of general
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    02-02-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Looking for solution to date and time problem

    Quote Originally Posted by FDibbins View Post
    Hi and welcome to the forum

    You need to understand how excel handles dates and times, to figure this out (and its really not that hard)

    dates are really just 5-digit numbers representing how many days have passed since 1/1/1900, excel formats them so we recognose dates
    Time is a decimal of 1 (day), so 6:00 Am is actually 0.25, 12 noon is 0.5 and so on

    So with those date/times above, you should be able to just run the calc, and then format as number of general
    That's good to know. Now when I try to do at TIME function it still gives me an error so I must be doing something wrong when trying to get a basic number for the time. When doing TIME wouldn't it be a problem that the date is in the same cell?

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Looking for solution to date and time problem

    Perhaps you are subtracting the larger from the smaller? excel doesnt like negative time

    A
    B
    C
    1
    Date/Time A5-A4 etc
    2
    1/29/2014 0:45
    3
    1/29/2014 0:48
    0.002083
    0:03:00
    4
    1/29/2014 0:53
    0.003472
    0:05:00
    5
    1/29/2014 1:07
    0.009722
    0:14:00


    column A is your sample times from above
    column B is A5=A4, A4-A3 etc, not formatted (0.002083 of 1 day)
    column C is formatted as time...0.002083 now becomes 0:03:00...3 minutes

  5. #5
    Registered User
    Join Date
    02-02-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Looking for solution to date and time problem

    Quote Originally Posted by FDibbins View Post
    Perhaps you are subtracting the larger from the smaller? excel doesnt like negative time

    A
    B
    C
    1
    Date/Time A5-A4 etc
    2
    1/29/2014 0:45
    3
    1/29/2014 0:48
    0.002083
    0:03:00
    4
    1/29/2014 0:53
    0.003472
    0:05:00
    5
    1/29/2014 1:07
    0.009722
    0:14:00


    column A is your sample times from above
    column B is A5=A4, A4-A3 etc, not formatted (0.002083 of 1 day)
    column C is formatted as time...0.002083 now becomes 0:03:00...3 minutes
    This is what I'm trying to do but I'm having trouble with the syntax for getting the value in column C.

  6. #6
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Looking for solution to date and time problem

    How about you show a sample of what you are working with,... we will probably be able too help you much faster, because we can see what is happening for ourselves !
    A picture may be worth a thousand words, BUT, a sample Workbook is worth a thousand screenshots!
    -Add a File - click advanced (next to quick post), scroll to manage attachments, click, select add files, click select files, select file, click upload, when file shows up at bottom left, click done (bottom right), click submit
    -To mark thread Solved- go top of thread,click Thread Tools,click Mark as Solved
    If you received helpful response, please remember to hit the * of that post

  7. #7
    Registered User
    Join Date
    02-02-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Looking for solution to date and time problem

    Ok, it looks like I found where my problem is. For some odd reason the date/time column actually looks like this

    '1/29/2014 00:53
    '1/29/2014 00:59

    So i have to get rid of the ' at the beginning of the date time. Any advice on that part?

    Thanks again for all the help so far!!!

  8. #8
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Looking for solution to date and time problem

    Depends on how that column is arrived at, if it is using a formula, then it is simply a matter of removing the ' from the formula, AND making sure the formula is returning a valid date number...again, a sample workbook would help

  9. #9
    Registered User
    Join Date
    02-02-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Looking for solution to date and time problem

    testsheet.xlstestsheet.xls

    This is what it spits out to me. I've taken out the sensitive info but this is the column that's giving me trouble.

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Looking for solution to date and time problem

    Try this...
    =DATEVALUE(A1)+TIMEVALUE(A1)
    format custom mm/dd/yyyy hh:mm:ss AM/PM

  11. #11
    Registered User
    Join Date
    02-02-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Looking for solution to date and time problem

    That did it. I can easily just use the value outputs to setup a system for rating the time difference. FDibbins, you rock, and so do all the rest of you. Thanks again for all your help!!!

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Looking for solution to date and time problem

    Happy to help

+ 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. Replies: 8
    Last Post: 01-31-2013, 05:22 AM
  2. Date and Time problem
    By E3iron in forum Excel General
    Replies: 4
    Last Post: 07-24-2009, 10:27 AM
  3. Date Time Problem - stop updating that each time the document is opened
    By Dreammy in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-28-2007, 03:31 PM
  4. Date and Time Problem
    By JDBARNES63 in forum Excel General
    Replies: 1
    Last Post: 04-19-2006, 02:40 AM
  5. [SOLVED] Seeking a solution to a time-consuming problem...
    By davidd31415 in forum Excel General
    Replies: 4
    Last Post: 06-18-2005, 11:05 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