ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   If statement using time of day (https://www.excelbanter.com/excel-discussion-misc-queries/212849-if-statement-using-time-day.html)

BAKERSMAN

If statement using time of day
 
I need to have E2 return a specific value based on the time of day.

If E2 is greater than or equal to 0600 but less than 1800 then I need to see
shift 1
If E2 is greater than or equal to 1800 but less than 0600 then I need to see
shift 2



Sheeloo[_3_]

If statement using time of day
 
Try

=IF(AND(E2=TIME(6,0,0),E2<TIME(18,0,0)),"Shift1", "Shift2")

"BAKERSMAN" wrote:

I need to have E2 return a specific value based on the time of day.

If E2 is greater than or equal to 0600 but less than 1800 then I need to see
shift 1
If E2 is greater than or equal to 1800 but less than 0600 then I need to see
shift 2



BAKERSMAN

If statement using time of day
 
Works great. Is there a way to have the cell be blank until the data is
entered for cell E2?

"Sheeloo" wrote:

Try

=IF(AND(E2=TIME(6,0,0),E2<TIME(18,0,0)),"Shift1", "Shift2")

"BAKERSMAN" wrote:

I need to have E2 return a specific value based on the time of day.

If E2 is greater than or equal to 0600 but less than 1800 then I need to see
shift 1
If E2 is greater than or equal to 1800 but less than 0600 then I need to see
shift 2



Sheeloo[_3_]

If statement using time of day
 
Yes, add another IF to check for blanks. Try
=IF(E2="","",IF(AND(E2=TIME(6,0,0),E2<TIME(18,0,0 )),"Shift1","Shift2"))

"BAKERSMAN" wrote:

Works great. Is there a way to have the cell be blank until the data is
entered for cell E2?

"Sheeloo" wrote:

Try

=IF(AND(E2=TIME(6,0,0),E2<TIME(18,0,0)),"Shift1", "Shift2")

"BAKERSMAN" wrote:

I need to have E2 return a specific value based on the time of day.

If E2 is greater than or equal to 0600 but less than 1800 then I need to see
shift 1
If E2 is greater than or equal to 1800 but less than 0600 then I need to see
shift 2




All times are GMT +1. The time now is 08:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com