View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
bpeltzer bpeltzer is offline
external usenet poster
 
Posts: 171
Default If statement with time values

You're comparing the full date/time (Oct 2 2008 8:15 AM) to just a time (6:59
AM). If you use just the fractional portion from column K, the comparison
should do what you're expecting. So where you have K3, I'd use
(k3-trunc(k3)).

"Dave Naples" wrote:

Hello:

I'd like to implement an if statement to return a value for whether the
time-of-day from a specific column is during the "day" or "night". I have
one column (K) with time in the hhmm format. I've attempted the following,
but it only gives me "night" as the result for all cases so something is not
working correctly.

=IF(AND(K3<TIME(19,0,0),K3TIME(6,59,0)),"DAY","NI GHT")

Could it have to do with my time format for column K? Any help would be
greatly appreciated