+ Reply to Thread
Results 1 to 6 of 6

Formula to compare time-dates

  1. #1
    Registered User
    Join Date
    04-15-2009
    Location
    morristown, ny
    MS-Off Ver
    Excel 2007
    Posts
    39

    Formula to compare time-dates

    I can not get my formulas to work as I need when the date/time passes past midnight.

    =IF($B40<'TIME BLOCKS (2)'!DF40,0,IF($B40>'TIME BLOCKS (3)'!DF40,0,1))


    10/18/09 8:00 PM
    10/19/09 4:00 AM

    This works well until the time span passes midnight.

    http://www.excelforum.com/attachment...cel-forum.xlsx
    Last edited by ed ayers315; 10-23-2009 at 04:45 PM. Reason: Was able to upload an example file

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: formula to compare cell values with dates

    Hi,

    What's in B40 & D40 on both the sheets, and what result are you expecting and why?

    It would help if you could upload a sample workbook so that we can see the request in context.

    Rgds
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    04-15-2009
    Location
    morristown, ny
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: formula to compare cell values with dates

    I tried to upload the files but received an error message "missing security token"

  4. #4
    Registered User
    Join Date
    04-15-2009
    Location
    morristown, ny
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: formula to compare cell values with dates

    I'll try to upload on this reply

    I zipped the file and it still would not uplaod

  5. #5
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: formula to compare cell values with dates

    Excel keeps track of dates as integers. Today is 40105 in excel time. Tomorrow will be 40106. To keep track of the time, it uses decimal parts of those integers. For example, maybe righ now is 40105.637429..., but in an hour it will be 40105.71268... So if you are using the < and > operators, you are actually comparing numbers. Thus tomorrow at 1:00 AM is still greater than today at 10:00 PM.

    Could that have something to do with your problem?
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  6. #6
    Registered User
    Join Date
    04-15-2009
    Location
    morristown, ny
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: formula to compare cell values with dates

    I wish I could upload the file; that would help to solve my problem.

    Thanks for the try!
    Last edited by ed ayers315; 10-22-2009 at 10:50 AM. Reason: Uploaded Example File

+ 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