Date and time formula

xxsalahxx

Active Member
Joined
Jun 25, 2011
Messages
316
Office Version
  1. 2007
Hello I have a spreadsheet with a lot of data, Column A shows the Day/Date for example in Cell A2 Monday/01/06/2020
In Column B I have the time in 24hr format 02:14. Im looking for a formula that will show in Column C if the Date falls on a Weekday (Monday to Friday) between the hours of 08:00 and 17:00 this will show "Within Hours" any thing out with this will be "Out of Hours".

If the day is a Saturday or a Sunday this will also show "out of hours". Is there a formula for this? Thanking you in advance for any help.

Thank
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Is A2 a real date or is it Text?
Is 01 the day or the month?
 
Upvote 0
What is the actual value in column A? Is this a date formatted as "Dddd dd/mm/yyyy", or is it text typed in just as you've shown? I recommend you use true date values when you are dealing with dates.

If you have real dates then this:

Cell Formulas
RangeFormula
A2:A7A2=A1+1
C1:C7C1=IF(AND(WEEKDAY(A1,2)<=5,B1>=TIMEVALUE("08:00"),B1<=TIMEVALUE("17:00")),"Within Hours","Out of Hours")
 
Upvote 0
Solution
What is the actual value in column A? Is this a date formatted as "Dddd dd/mm/yyyy", or is it text typed in just as you've shown? I recommend you use true date values when you are dealing with dates.

If you have real dates then this:

Cell Formulas
RangeFormula
A2:A7A2=A1+1
C1:C7C1=IF(AND(WEEKDAY(A1,2)<=5,B1>=TIMEVALUE("08:00"),B1<=TIMEVALUE("17:00")),"Within Hours","Out of Hours")
 
Upvote 0
What is the actual value in column A? Is this a date formatted as "Dddd dd/mm/yyyy", or is it text typed in just as you've shown? I recommend you use true date values when you are dealing with dates.

If you have real dates then this:

Fantastic this solved it, thank you so much
 
Upvote 0
Date and Time.xlsm
ABCDE
108:0017:00
2Monday 01-Jun-2002:14Out of Hours
3Monday 01-Jun-2009:00Within Hours
4Monday 01-Jun-2014:00Within Hours
5
24c
Cell Formulas
RangeFormula
C2C2=IF(AND(WEEKDAY(A2,2)<6,B2>=$D$1,B2<=$E$1),"Within Hours","Out of Hours")
C3C3=IF(AND(WEEKDAY(A3,2)<6,B3>=0.333333333333333,B3<=0.708333333333333),"Within Hours","Out of Hours")
C4C4=IF(AND(WEEKDAY(A4,2)<6,B4>=8/24,B4<=17/24),"Within Hours","Out of Hours")
 
Upvote 0

Forum statistics

Threads
1,214,822
Messages
6,121,770
Members
449,049
Latest member
greyangel23

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