looking for the syntax for the following time and day

cmeredith1973

New Member
Joined
Apr 8, 2019
Messages
33
Office Version
  1. 365
Platform
  1. Windows
Hi - I have a date and time col. I can pull out the day of the week, and the hour in 2 seperate cols. What I am looking for is the formula, that would be if, and or. e.g. if the hour is >=5pm or 17 in 24time, and is a friday, or is simply saturday or sunday, to put an x. I have gotten here,=IF(AND(AA2=1,AB2="After 5"),"x","") but can loop in the friday after 5 and saturday/sunday.

THe 1 is a true/false statement, that its sat/sun in excel.

Thank you
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Thank you Oaktree, I think I need another AND. I have a formula that will pull out the HOUR(B2>17,"after hours). but its not connecting that it could be friday after 5, and saturday or sunday
 
Upvote 0
Code:
=IF(OR(AND(Day is Friday, Hour >= 17), Day is Saturday or Sunday),"X","")
=IF(OR(AND(WEEKDAY(Date,2)=5,HOUR(Time)>=17),WEEKDAY(Date,2)>5),"X","")
=IF(OR(AND(WEEKDAY(AA2,2)=5,HOUR(AB2)>=17),WEEKDAY(AA2,2)>5),"X","")
 
Upvote 0
Solution
Thats why you are the MrExcel MVP, Oaktree. That was awesome, works perfectly.
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,731
Members
448,987
Latest member
marion_davis

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