+ Reply to Thread
Results 1 to 10 of 10

formula to insert 1 if time in and time out time is within the slots (military time)

  1. #1
    Registered User
    Join Date
    02-21-2020
    Location
    Santa F
    MS-Off Ver
    MS Office 10
    Posts
    5

    Unhappy formula to insert 1 if time in and time out time is within the slots (military time)

    What type of formula to insert 1 if time in and time out time is within the slots (military time)or leave blank if not within slot range? Example:

    Time In Time Out 7-8 8-9 9-10 10-11 11-12 12-13 13-14 14-15 15-16
    09:00 11:10 1 1 1 1
    12:00 15:00 1 1 1
    7:00 9:00 1 1
    10:00 12:20 1 1 1




    I am trying to use spreadsheet to show how many cases were within each hour I will have dates and day of the week also, but this was the one I'm having a hard time with. Is this possible?
    I appreciate your assistance.
    Last edited by AliGW; 02-22-2020 at 02:22 AM.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Formula

    I cannot post my formula.

    Your Solution is attached.

    Mod Edit:

    =IF(OR(HOUR($A2)=COLUMN()+4,HOUR($B2+59/24/60)=COLUMN()+5,AND(HOUR($A2) < COLUMN()+4,HOUR($B2+59/24/60) > COLUMN()+5)),1,"")
    Attached Files Attached Files
    Last edited by AliGW; 02-22-2020 at 02:26 AM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2501 (Windows 11 24H2 64-bit)
    Posts
    89,014

    Re: formula to insert 1 if time in and time out time is within the slots (military time)

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however the thread title does not really convey what your request is about. Almost everyone here needs s formula of some sort!

    Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).

    Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

    (Note: this change is not optional. NAs you are new, I have done it for you this time.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  4. #4
    Registered User
    Join Date
    02-21-2020
    Location
    Santa F
    MS-Off Ver
    MS Office 10
    Posts
    5

    Re: Formula

    How do I use this formula with 1/2 slots, like 7:30 - 12:30, 12:30 - 15:30?

  5. #5
    Registered User
    Join Date
    02-21-2020
    Location
    Santa F
    MS-Off Ver
    MS Office 10
    Posts
    5

    Re: Formula

    I like what this formula does. I need something similar. I need to calculated the minutes within a time slot. The time slots are in 1/2 hour increments. Example

    7:30 - 12:30, 12:30 - 15:30
    Times worked were:
    7:15 - 14:30. I need a formula to calculate how many minutes worked between 7:30 - 12:30.
    7:45 - 16:45 I need a formula to calculate how many minutes worked between 12:30 - 15:30.

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    18,539

    Re: formula to insert 1 if time in and time out time is within the slots (military time)

    This request might be resolved using a different arrangement/formula.
    The formula could be: =(MIN($B4,C$3)-MAX($A4,C$2))*24*60
    See that attached file for the arrangement.
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  7. #7
    Registered User
    Join Date
    02-21-2020
    Location
    Santa F
    MS-Off Ver
    MS Office 10
    Posts
    5

    Re: formula to insert 1 if time in and time out time is within the slots (military time)

    Thank you. Worked great. One more question. What would I used to calculate minutes before 7:30 on one column and minutes after 15:00 on another from two set times(In room and out of room)?

  8. #8
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    18,539

    Re: formula to insert 1 if time in and time out time is within the slots (military time)

    The formula for before 7:30 could be: =MAX(0,C$2-A4)*24*60
    The formula for after 15:00 (if this should be 15:30 as in post #5 change the times in E3:F3) could be: =MAX(0,B4-F$3)*24*60
    Let us know if you have any questions.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    02-21-2020
    Location
    Santa F
    MS-Off Ver
    MS Office 10
    Posts
    5

    Re: formula to insert 1 if time in and time out time is within the slots (military time)

    Thank you so much for the response. I think I worded the question wrong. I need to calculate minutes within the two times that are after 15:00.
    Lets say.
    15:25 - 15:55 = 30 min. after 15:00 0 min within block
    19:10 - 19:50 = 40 min. after 15:00 0 min within block
    14:25 - 18:00 = 180 min. after 15:00 35 min within block
    13:30 - 16:00 = 60 min. after 15:00 90 min within block
    6:45 - 18:00 = 180 min. after 15:00 45 min. before 7:30 and 450 within block.

    Does this make sense? I count case minutes after the block range as well as minutes before block range. In my case the block range is 7:30 - 15:00.

  10. #10
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    18,539

    Re: formula to insert 1 if time in and time out time is within the slots (military time)

    Have made a couple of changes:
    Within the block: =(MAX(0,MIN($B4,D$3)-MAX($A4,D$2)))*24*60
    After the block: =MAX(0,MIN(B4-A4,B4-F$3))*24*60
    Let us know if you have any questions.
    Attached Files Attached Files

+ 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: 3
    Last Post: 01-10-2019, 09:34 AM
  2. Replies: 5
    Last Post: 02-16-2018, 06:50 AM
  3. Replies: 8
    Last Post: 09-22-2017, 05:41 AM
  4. Excel formula bar to display the result of the formula , not the formula?
    By max_max in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-18-2016, 07:15 PM
  5. Replies: 11
    Last Post: 06-06-2014, 03:34 PM
  6. how to hide formula in formula box, view lookup result in formula box?
    By vengatvj in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-14-2013, 04:06 PM

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