I want to compare the time from a column called "Date and time" (datetime format) with a fixed time value. I have created a calculated column for this.

=IF(AND(TIME([Date and time])>TIMEVALUE("06:00:00");TIME([Date and time])<TIMEVALUE("18:00:00");"Day";"Night"))

It works when I use the HOUR() function, but I want to be able to use specific minutes.

What is wrong with this code?


1 Answer 1


Using the following formulas:

=IF(AND(TIME(HOUR([Date and time]),MINUTE([Date and time]),SECOND([Date and time]))>TIMEVALUE("06:00:00"),TIME(HOUR([Date and time]),MINUTE([Date and time]),SECOND([Date and time]))<TIMEVALUE("18:00:00")),"Day","Night")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.