ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Greater than AND Less than Time Q (https://www.excelbanter.com/excel-worksheet-functions/223578-greater-than-less-than-time-q.html)

Seanie

Greater than AND Less than Time Q
 
How could I construct a formula that checks if the Current Time is
Greater than 7:00pm and Less than 12:00am



ExcelBanter AI

Answer: Greater than AND Less than Time Q
 
Here's the formatted text:

You can use the following formula to check if the current time is greater than 7:00 pm and less than 12:00 am:

Formula:

=IF(AND(TIME(HOUR(NOW()),MINUTE(NOW()),SECOND(NOW()))TIME(19,0,0),TIME(HOUR(NOW()),MINUTE(NOW()),SECOND(NOW()))<TIME(0,0,0)), "Yes""No"

Let me explain how this formula works:
  1. The NOW() function returns the current date and time.
  2. The HOUR(), MINUTE(), and SECOND() functions extract the hour, minute, and second from the current time.
  3. The TIME() function creates a time value based on the specified hour, minute, and second.
  4. The AND() function checks if both conditions are true: the current time is greater than 7:00 pm and less than 12:00 am.
  5. The IF() function returns "Yes" if the conditions are true, and "No" if they are false.

So, when you enter this formula in a cell, it will return "Yes" if the current time is greater than 7:00 pm and less than 12:00 am, and "No" if it is not.

Pete_UK

Greater than AND Less than Time Q
 
12:00am meaning midnight?

Try this:

=IF(TIME(A1)19/24,"yes","no")

No need to test for the other condition.

But, if you were interested in, say, times greater than 7:00pm and
times less than 10:00pm, then you would have this:

=IF(AND(TIME(A1)19/24,TIME(A1)<22/24),"yes","no")

Note the use of the 24-hour clock.

Hope this helps.

Pete

On Mar 9, 8:52*am, Seanie wrote:
How could I construct a formula that checks if the Current Time is
Greater than 7:00pm and Less than 12:00am



DILipandey

Greater than AND Less than Time Q
 
Hi Seanie,

Assuming you have the current time in cell A1, write 7:00:00 PM in B1 and
11:59:59 PM in B2. After entering, both of them will appear as
19:00
23:59, respectively,

Now apply the following formula.

=IF(AND(A1B1,A1<B2),"Yes","No")
Hope it helps.
--
Dilip Kumar Pandey
MBA, BCA, B.Com(Hons.)


New Delhi, India


"Seanie" wrote:

How could I construct a formula that checks if the Current Time is
Greater than 7:00pm and Less than 12:00am





All times are GMT +1. The time now is 03:17 AM.

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