+ Reply to Thread
Results 1 to 6 of 6

Need formula to calculate the numbers of hours and get the value true or false

  1. #1
    Forum Contributor
    Join Date
    06-12-2013
    Location
    india
    MS-Off Ver
    Office 365
    Posts
    218

    Need formula to calculate the numbers of hours and get the value true or false

    Hi Team,

    I have attached the sample file where in the A column I have approved date and time and in the B column I have ordered date and time and I need to get the values (true or false) in C column. Please check and assist.

    If the orders are approved before 17:00 and the ordered date shows as same date before 17:00 then the value should come as true.
    If the orders are approved before 17:00 and the ordered date shows next date or other dates it should come as false.
    If the orders are approved after 17:00 and the ordered date shows next network day date before 16:00 it should give the value as true.
    If the orders are approved after 17:00 and the ordered date shows next network day date after 16:00 it should give the value as false.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,809

    Re: Need formula to calculate the numbers of hours and get the value true or false

    Try

    =IF(AND(INT(A10)=INT(B10),MOD(A10,1)<=TIME(17,0,0)),TRUE,IF(AND(INT(B10)=WORKDAY(INT(A10),1),MOD(B10,1)<=TIME(16,0,0)),TRUE,FALSE))
    Last edited by JohnTopley; 08-23-2021 at 08:01 AM.

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,079

    Re: Need formula to calculate the numbers of hours and get the value true or false

    Your third condition
    If the orders are approved after 17:00 and the ordered date (shouldn't this be approval date?) shows next network day (after what the approved date????) date before 16:00 it should give the value as true.

    This gets you the results you have supplied but the logic doesn't look right to me (check your third condition above)
    =IF(OR(AND(INT(A2)=INT(B2),TEXT(B2,"hh:mm")<"17:00"),AND(TEXT(A2,"hh:mm")>"17:00",INT(B2)=WORKDAY(A2,1),TEXT(B2,"hh:mm")<"16:00")),TRUE,FALSE)
    Last edited by Special-K; 08-23-2021 at 07:54 AM.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  4. #4
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,079

    Re: Need formula to calculate the numbers of hours and get the value true or false

    Quote Originally Posted by JohnTopley View Post
    Try

    =IF(AND(INT(A2)=INT(B2),MOD(A2,1)<=TIME(17,0,0)),TRUE,IF(AND(INT(B2)=INT(A2)+1,MOD(B2,1)<=TIME(16,0,0)),TRUE,FALSE))
    John, I'm getting TRUE for 04/08 and 29/07 Approval dates, rows 4 and 8 with your formula

  5. #5
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,222

    Re: Need formula to calculate the numbers of hours and get the value true or false

    Please try at D2

    =B2<IF(MOD(A2*24,24)<17,INT(A2)+17/24,WORKDAY(A2,1)+16/24)
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    01-05-2013
    Location
    Singapore
    MS-Off Ver
    H&B2019
    Posts
    4,542

    Re: Need formula to calculate the numbers of hours and get the value true or false

    Another formula:
    =OR(AND(MOD(A2,1)<17/24,INT(B2)=INT(A2)),AND(MOD(A2,1)>=17/24,B2<WORKDAY(A2,1)+16/24))

+ 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] IF formula is TRUE, then calculate until next is FALSE
    By mikehk in forum Excel General
    Replies: 6
    Last Post: 08-23-2020, 10:26 PM
  2. Converting Numbers to TRUE or FALSE
    By Excel_vba in forum Excel General
    Replies: 11
    Last Post: 04-30-2014, 01:59 AM
  3. [SOLVED] IF Statement Returns False When True On Certain Numbers
    By paulm99 in forum Excel General
    Replies: 3
    Last Post: 11-26-2013, 04:41 PM
  4. TRUE or FALSE for a range of numbers
    By Caedmonball19 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-29-2013, 12:41 PM
  5. [SOLVED] Calculating if hours taken are true or false by 4 different criteria.
    By SamCrome in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-16-2012, 08:25 AM
  6. Replies: 3
    Last Post: 02-11-2012, 03:07 PM
  7. Formula that separates TRUE/FALSE From Numbers
    By artiststevens in forum Excel General
    Replies: 2
    Last Post: 12-15-2010, 01:43 AM

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