+ Reply to Thread
Results 1 to 4 of 4

Using Time in formulas

  1. #1
    Forum Contributor
    Join Date
    06-20-2012
    Location
    Derby
    MS-Off Ver
    Excel 2010
    Posts
    381

    Using Time in formulas

    Hi All,

    I need a bit of help with a formula involving time.

    In column H of the 'Formula' page a I have formula that looks at the dates in column D of the 'Week' page and returns a numerical list.

    This is the formula -=IF(OR(E2=Week!$D$2,E2=Week!$D$3,),COUNT(H$1:H1)+1,"")

    I'm not sure if it's because the date also lists a time, but what I want it to do is list everything for todays date up to 12pm the following day.

    Is there a way for it the date in the 'Week' page to look from 00:00am of today to 12:00pm the following day?
    Attached Files Attached Files

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,496

    Re: Using Time in formulas

    The problem is that the value in E2 is coming across as text. Change the formula to: =--Intouch!EA2

    Then, in H2, put: =IF(AND(E2>=Week!$D$2+TIME(0,0,0),E2<=Week!$D$3+TIME(12,0,0)),COUNT(H$1:H1)+1,"")

    Copy both formulae down.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    06-20-2012
    Location
    Derby
    MS-Off Ver
    Excel 2010
    Posts
    381

    Re: Using Time in formulas

    That's brilliant, thank you. So by put a -- converts text to a date...? Is that correct?

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,496

    Re: Using Time in formulas

    You're welcome.

    So by put a -- converts text to a date...? Is that correct?
    Not exactly, it coerces a number stored as text to a true number. A date is just a number representing the number of days from 1 January 1900 and a time is a number representing a fraction of a day. So, add a real date and time together and you get a number. Previously, I think you were comparing text to numeric.

    Anyway, short story, by making sure all the numbers are real numbers, the comparisons work as you expect them to.


    Regards, TMS



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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