+ Reply to Thread
Results 1 to 9 of 9

A formula to satisfy a condition for a time range having date also

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

    A formula to satisfy a condition for a time range having date also

    Hi, I have a date and time column as follows:

    08/01/2013 00:54:15
    08/01/2013 08:03:01
    08/01/2013 09:32:52
    08/01/2013 13:03:43
    08/01/2013 15:32:44

    In the adjoining column, I need to satisfy a condition below: If the time is between 06:30:00 and 18:00:00 then it should return True, else False How can this be made possible?

    If in the same file in separate column if I could identify weekdays vs weekends based on the date, it would be very helpful.

    An example file has been attached to the ticket.
    Attached Files Attached Files

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: A formula to satisfy a condition for a time range having date also

    For the TimeRange
    =AND(MOD(A2,1)>="06:30:00"+0,MOD(A2,1)<="18:00:00"+0)


    For weekday vs weekend
    =IF(WEEKDAY(A2,2)>5,"Weekend","Weekday")

  3. #3
    Valued Forum Contributor
    Join Date
    09-04-2012
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    463

    Re: A formula to satisfy a condition for a time range having date also

    use the attached file

    if there is any further query then feel free to ask.

    if it was really helpful to you then dont forget to hit * button for user reputation.

    Regards
    CA Mahaveer Somani
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    07-02-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    197

    Re: A formula to satisfy a condition for a time range having date also

    Hi, Vijitkumar

    Put this formula in cell B2:

    =IF(AND(B2<TIME(18,0,0),B2>TIME(5,59,59)),"TRUE","FALSE")

    Copy down
    Attached Files Attached Files
    Last edited by Rambo4711; 09-03-2013 at 03:03 PM.

  5. #5
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: A formula to satisfy a condition for a time range having date also

    Quote Originally Posted by Rambo4711 View Post
    =IF(AND(B2<TIME(18,0,0),B2>TIME(5,59,59)),"TRUE","FALSE")
    Don't see how that will work because:
    1. The values are in column A
    2. The values are DATE+Time, not just time.
    So none of the values are < TIME(18,0,0)

    You have to extract the time from the cell that contains Date+Time
    I used MOD for that purpose.

  6. #6
    Forum Contributor
    Join Date
    07-02-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    197

    Re: A formula to satisfy a condition for a time range having date also

    @Jonmo1

    Just edited my post and attached a file. Can you see any wrong answers in the formulas?

  7. #7
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: A formula to satisfy a condition for a time range having date also

    Quote Originally Posted by Rambo4711 View Post
    @Jonmo1

    Just edited my post and attached a file. Can you see any wrong answers in the formulas?
    Yes.

    The OP's File has Date+Time in Column A.
    How are you getting from Date+Time in A, to having
    Date in A and Time in B ?

  8. #8
    Valued Forum Contributor
    Join Date
    09-04-2012
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    463

    Re: A formula to satisfy a condition for a time range having date also

    ROMBO USED MY TRick @ JONMO as i already post.

    and @jonmo your formula is not working........

  9. #9
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: A formula to satisfy a condition for a time range having date also

    Quote Originally Posted by mahaveersomani View Post
    and @jonmo your formula is not working........
    In what way is mine not working on the file attached by the OP??


    EFvijitkumar.xlsx

+ 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. count the number of cells if condition satisfy
    By rosh@excel in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-22-2012, 10:09 AM
  2. Find some numbers that satisfy a given condition
    By Atoli in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-14-2012, 01:58 AM
  3. Move to new cell if certain condition satisfy
    By keis386 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-12-2011, 10:09 AM
  4. revert cell value if the sum does not satisfy a condition
    By spawn3010 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-10-2011, 07:14 AM
  5. formula to return # hrs after time a day/date condition
    By adhide in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-30-2009, 07:55 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