Using IF with hour formed cells.

Copper Contributor
I need to make a condition:
If entrance hour is between 22:00 and 05:00...
How can I do it using if or ifs formula?
Excel 365
Thanks.
16 Replies

@itaytr 

I know I don't know anything (Socrates)

 

 

With your permission, if I can recommend. It can help us all if you upload an Excel file (without sensitive data), no picture. Even if it is said that a picture can say a thousand words, it is certainly not in the case of Excel, on the contrary in some cases. This would also be a blessing for all of us, as we can understand the problem much better, a win-win situation for everyone.

* Knowing the Excel version and operating system would also be an advantage.

 

Thank you for your understanding and patience

 

Nikolino

I know I don't know anything (Socrates)

I attached a file for example.
Waiting for a solution.

@itaytr 

When the admission hour is between 10:00 PM and 5:00 AM ... what should happen here?

Excel is from the Arabic or Hebrew region.

From right to left.

In your Excel sheet you only have these lines

entering hour
22:00:00
19:00:00
23:15:00
06:00:00
04:15:00

... what should become of them?

... and as already written, please state the Excel version and operating system,

if possible exactly (e.g. Excel 365 Pro or Win10-2004).

Forgive us for the circumstances, but if no precise task can be set and no precise instructions can be given, then in the best case, only an imprecise solution can be suggested to you.

 

Thanks for your patience and understanding

 

Nikolino

I know I don't know anything (Socrates)

@itaytr 

Just the comparison:

=OR((B5>--"22:00:00"),(B5<--"05:00:00"))
Hi Nikolino,
I updated the file and added a column with what I want to achieve.
I'm using excel in my android phone.
I'll try to be specific about what I want:
I want a formula to tell me if the entrance time is between 22:00 and 05:00.
If the answer to the above is yes - I want a "yes" as a outcome.
It is excel for Hebrew.

@Detlef Lewin

Thanks! 

1. Is ">--" means after and "<--" before?

2. Will it work in other formulas? 

3. The option you suggested does not count the exact time 22:00:00 in the range, 

Is there a way to include it in (like "=>" in math)?

 

Thanks again! 

@itaytr 

< means smaller than, > means greater than and -- is a type conversion from text to number because the time is set in double quotes which means Excel regards it as text.

If you want to include the lower and upper boundaries change < to <= and > to >=.

 

@itaytr 

As variant

=B5=MEDIAN(B5,5/24,22/24)

@Sergei Baklan 

Are you sure?

Your formula returns the same result only in row 5.

 

@Detlef Lewin 

Nope, I'm not sure. Perhaps I misunderstood what shall be true and what false:

image.png

@Sergei Baklan 

Well, then let's wait for the tread opener to decide.

 

True is when an entering time is between 22:00 to 05:00.
Is there a way to check with a formula if an employee worked 2 hours or more between 22:00 to 05:00.
In the file attached to this reply, Jimmy and Ronni suppose to be "TRUE" and the rest should be "False".

@itaytr 

And here we are with a totally different problem.

=((1-MAX(B5,22/24))+(MIN(C5,5/24)-1)+(C5<B5))>=2/24

@itaytr 

Since I have a great weakness for the Hebrew culture, please allow me and everyone else involved to add my thoughts.

Everything in the file, maybe it will help you to develop your project further.

 

Hope my thoughts in the file fits into your project.

 

Thank you for your patience and time.

 

Wish you a nice day / night with lots of health, joy and love.

 

Nikolino

I know I don't know anything (Socrates)

@Detlef Lewin 

It only to be adjusted to night shifts like start 01:00 and end 08:00