Help with formula time frame

GenAkaman

New Member
Joined
Dec 6, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
At a daycare 8:00 AM cell V208 is the start time and 6:00 PM cell W208 is the end time. First shift starts at 8 am (AV2) and ends at 6 pm (AW2). I need a 1 if this providers hours are within first shift or a 0 if not. here is my current formula. It is giving me a 0 when I should have a yes. =IF(AND(V208<=$AV$2,W208>=$AW$2),1,0)+IF(W208<V208,1,0). Some time frames will cross midnight.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
How about this?

Book2
VWX
207Start TimeEnd Time
2088:00 AM6:00 PM0
2096:00 PM2:00 AM1
Sheet3
Cell Formulas
RangeFormula
X208:X209X208=LET(SE,IF(ShiftEnd1<ShiftStart1,1+ShiftEnd1,ShiftEnd1),ET,IF(W208<V208,1+W208,W208),IF(AND(V208<SE,ET>ShiftStart1),1,0))
Named Ranges
NameRefers ToCells
ShiftEnd1=Sheet3!$AW$2X208:X209
ShiftStart1=Sheet3!$AV$2X208:X209


Book2
AVAW
1Shift StartShift End
26:00 PM2:00 AM
Sheet3
 
Upvote 0
Thanks for the warm welcome! This formula is not working for me and I would really like to make the current formula that I have work, if possible. =IF(AND(V208<=$AV$2,W208>=$AW$2),1,0)+IF(W208<V208,1,0)
I only receive the wrong answer when this portion of the formula brings about two true ifs =IF(AND(V208<=$AV$2,W208>=$AW$2),1,0) and a false for this portion + IF(W208<V208,1,0) the final answer will be false. OR the formula brings about two false ifs =IF(AND(V208<=$AV$2,W208>=$AW$2),1,0) and a true for this portion + IF(W208<V208,1,0) the final answer will be true.
I also need to account for when time crosses 1am for some reason the current formula works for 12am -12:59am.
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,291
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top