Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I am trying to see if we received entries into a system after 7:45pm and before 11pm on each day. I keep receiving errors that my result set is to large or too small.
How can I return true if I receieve an entry in my recordinsertdate column falls between 7:45pm and 11pm?
My current formula is:
=IF(AND(TIME([RecordInsertDate],[RecordInsertDate],[RecordInsertDate]) > TIME(19,45,0),
TIME([RecordInsertDate],[RecordInsertDate],[RecordInsertDate]) < TIME(23,0,0)),
"TRUE", "FALSE")
My RecodInsertDate has a value format like 20/06/2017 9:46:19 PM
Solved! Go to Solution.
You can consider dates as whole numbers and times as fractions.
Let's take June 22, 2017, 18:00 (or 6:00 PM) as an example.
The date value is 42,908 and the time value 0.75, so together 42,908.75.
In order to get the time value, you need to subtract the integer value, so:
42,908.75 - 42,908 = 0.75 which is equivalent with TIME(18,0,0).
Furthermore, you want TRUE or FALSE as a result (not the text "TRUE" or "FALSE"), so you can just use the AND function with both conditions, which will return TRUE or FALSE. No IF required.
Try this:
= AND(([RecordInsertDate]-INT([RecordInsertDate])) > TIME(19,45,0),([RecordInsertDate]-INT([RecordInsertDate])) < TIME(23,0,0))
Note: if your time is exactly 19:45:00 or 23:00:00, the formula returns false. If this should be true, change the formula to:
= AND(([RecordInsertDate]-INT([RecordInsertDate])) >= TIME(19,45,0),([RecordInsertDate]-INT([RecordInsertDate])) <= TIME(23,0,0))
Thanks, that works but I don't understand why.
You can consider dates as whole numbers and times as fractions.
Let's take June 22, 2017, 18:00 (or 6:00 PM) as an example.
The date value is 42,908 and the time value 0.75, so together 42,908.75.
In order to get the time value, you need to subtract the integer value, so:
42,908.75 - 42,908 = 0.75 which is equivalent with TIME(18,0,0).
Furthermore, you want TRUE or FALSE as a result (not the text "TRUE" or "FALSE"), so you can just use the AND function with both conditions, which will return TRUE or FALSE. No IF required.