+ Reply to Thread
Results 1 to 4 of 4

IF function with Time difference

  1. #1
    Registered User
    Join Date
    11-02-2020
    Location
    Denmark
    MS-Off Ver
    16
    Posts
    2

    Question IF function with Time difference

    *Time is in 24 hour clock*

    Monday 06:00 to 19:00 (Would be 1 hour in total)
    Tuesday 05:30 to 16:00 (Would be half an hour in total)
    Wednesday 05:30 to 18:30 (Would be 1 hour in total)

    I would like a function that can count certain hours between the the given shifts.

    So an "IF function" that counts the hours >(less than) 6:00 but also >(greater than) 18:00, so you get the total amount of hours Both less than 6AM and greater than 6PM.

    I have created an IF function that can count the hours past 6pm, and also one that can count before 6am, but I have failed to create one that can do both and add them together.
    Attached Files Attached Files
    Last edited by Shaaxy; 11-02-2020 at 05:22 PM.

  2. #2
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365 for MAC
    Posts
    3,105

    Re: IF function with Time difference

    why would this be half an hour?
    Tuesday 05:30 to 16:00 (Would be half an hour in total)

    Try in D2 and down:
    =(VALUE(C2)-VALUE(B2))-0.5
    Last edited by Limor_OP; 11-02-2020 at 06:03 PM.

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: IF function with Time difference

    Try this
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Registered User
    Join Date
    11-02-2020
    Location
    Denmark
    MS-Off Ver
    16
    Posts
    2
    Quote Originally Posted by belinda200 View Post
    why would this be half an hour?
    Tuesday 05:30 to 16:00 (Would be half an hour in total)

    Try in D2 and down:
    =(VALUE(C2)-VALUE(B2))-0.5

    This would be Half an hour due to the time from 05:30 - 06:00

+ 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: 1
    Last Post: 10-18-2019, 12:38 AM
  2. Replies: 3
    Last Post: 08-12-2017, 01:48 AM
  3. [SOLVED] Difference between initial time and final time code not working correcly!
    By redsab in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-07-2017, 06:28 AM
  4. [SOLVED] Time in Time format and text foramt - Finding the Hours difference
    By thilag in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-19-2013, 07:14 AM
  5. [SOLVED] Caculating the Time difference from Start & end date/time excludin weekends & non ofce hrs
    By Harry Jones in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-08-2012, 06:25 AM
  6. Converting a time difference calculation worksheet formula to a VBA Function
    By LoveCandle in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-19-2012, 03:25 PM
  7. Excel Function to calculate difference in time in same cell
    By jr white in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-08-2007, 01:16 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