Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default If statement with time values

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
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default If statement with time values

Thanks. That seems to have worked perfectly.

Dave


"bpeltzer" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
If statement to compare time cell to a time Z-Man-Cek Excel Worksheet Functions 16 July 29th 16 08:17 AM
using if statement to subtract 24 hours from time still shows as a negative time from both responses under 24 hours richard.littlewing Excel Worksheet Functions 2 September 15th 08 08:05 AM
Converting date/time serial values to cumulative time totals... Kevin B Excel Discussion (Misc queries) 4 October 18th 07 05:05 PM
IF statement to calculate time usage in specific time bands Daren Excel Worksheet Functions 6 January 31st 07 01:34 PM
how do i sum up a column of time values but ignore negative values Croll New Users to Excel 1 October 11th 05 05:55 PM


All times are GMT +1. The time now is 06:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"