Forum

Notifications
Clear all

Check if value is between certain times

4 Posts
3 Users
0 Reactions
147 Views
(@causevr)
Posts: 22
Eminent Member
Topic starter
 

Hello,

I need help with an issue that I can't get with the IF formula.

If the clock(time) is between 00:00 and 06:00h to return 1. 

ie:if it's 01:00am to return 1.  If not, return 0.

How can I get this solution?

 

Thank you.

 

Regards, 

Riste.

 
Posted : 23/06/2020 4:22 am
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Hi Riste,

Times and dates are stored as 'serial' numbers in excel so if your time is in A1 you can use

=IF(AND(A1>0,A1<0.25),1,0)

This article explains Date and Time in Excel

Regards

Phil

 
Posted : 23/06/2020 4:42 am
(@causevr)
Posts: 22
Eminent Member
Topic starter
 

Thank you Phil.

I appreciate it.

 

Best Regards, 

Riste.

 
Posted : 23/06/2020 4:20 pm
(@jim)
Posts: 16
Eminent Member
 

Hi Riste,

If your cell might also have a date component and you only wish to check that the time part is before 6am then you could use:

=--(ISNUMBER(A1)*(MOD(N(A1),1)<=0.25))

blanks, text and any times after 6am will return 0; times between midnight and 6am (inclusive) will return 1

Regards

jim

 
Posted : 26/06/2020 5:16 pm
Share: