Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Time - How do you see if a time value is between 2 values?

I want to perform a conditional formating in Excel that says:

If the time is between 07:00 and 13:59 then turn the cell border red and
turn the font red.

if the time is between 14:00 and 07:00 turn the cell green.
Condition 1
This works to turn the cell green: =$F$4<=$E$4

Condition 2
This works to change the font red: =$F$4=$E$4

Condition 3
This does not turn the cell green: =$F$4TIME(14,0,0)


Does anyone have any idea on how can I code this so that it will work?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Time - How do you see if a time value is between 2 values?

The problem is probably because either condition 1 or condition 2 (one or
the other) is always being met so condition 3 NEVER gets evaluated.

You have an overlap in your conditions at 7:00. You only need 2 conditions.

Try these:

Condition 1 - GREEN (between 14:00 and 6:59 inclusive)

=AND(ISNUMBER(cell_ref),OR(cell_ref=TIME(14,0,0), cell_ref<TIME(7,0,0)))

Condition 2 - RED (between 7:00 and 13:59 inclusive)

=AND(cell_ref=TIME(7,0,0),cell_ref<=TIME(13,59,0) )



--
Biff
Microsoft Excel MVP


"Waitsu" wrote in message
...
I want to perform a conditional formating in Excel that says:

If the time is between 07:00 and 13:59 then turn the cell border red and
turn the font red.

if the time is between 14:00 and 07:00 turn the cell green.
Condition 1
This works to turn the cell green: =$F$4<=$E$4

Condition 2
This works to change the font red: =$F$4=$E$4

Condition 3
This does not turn the cell green: =$F$4TIME(14,0,0)


Does anyone have any idea on how can I code this so that it will work?

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,510
Default Time - How do you see if a time value is between 2 values?

Not sure that I really understand but this might put you on the right track
when trying to format based on between 2 values using AND function:-

Example1:-
=AND($E$5<$E$4,$E$5$F$4)


Example2:-
=AND($F$5<$E$4,$F$5TIME(7,0,0))


Regards,

OssieMac




"Waitsu" wrote:

I want to perform a conditional formating in Excel that says:

If the time is between 07:00 and 13:59 then turn the cell border red and
turn the font red.

if the time is between 14:00 and 07:00 turn the cell green.
Condition 1
This works to turn the cell green: =$F$4<=$E$4

Condition 2
This works to change the font red: =$F$4=$E$4

Condition 3
This does not turn the cell green: =$F$4TIME(14,0,0)


Does anyone have any idea on how can I code this so that it will work?

Thanks

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Time - How do you see if a time value is between 2 values?

Thanks - this seems to have solved my problem.

"T. Valko" wrote:

The problem is probably because either condition 1 or condition 2 (one or
the other) is always being met so condition 3 NEVER gets evaluated.

You have an overlap in your conditions at 7:00. You only need 2 conditions.

Try these:

Condition 1 - GREEN (between 14:00 and 6:59 inclusive)

=AND(ISNUMBER(cell_ref),OR(cell_ref=TIME(14,0,0), cell_ref<TIME(7,0,0)))

Condition 2 - RED (between 7:00 and 13:59 inclusive)

=AND(cell_ref=TIME(7,0,0),cell_ref<=TIME(13,59,0) )



--
Biff
Microsoft Excel MVP


"Waitsu" wrote in message
...
I want to perform a conditional formating in Excel that says:

If the time is between 07:00 and 13:59 then turn the cell border red and
turn the font red.

if the time is between 14:00 and 07:00 turn the cell green.
Condition 1
This works to turn the cell green: =$F$4<=$E$4

Condition 2
This works to change the font red: =$F$4=$E$4

Condition 3
This does not turn the cell green: =$F$4TIME(14,0,0)


Does anyone have any idea on how can I code this so that it will work?

Thanks




  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Time - How do you see if a time value is between 2 values?

You're welcome. Thanks for the feedback!

--
Biff
Microsoft Excel MVP


"Waitsu" wrote in message
...
Thanks - this seems to have solved my problem.

"T. Valko" wrote:

The problem is probably because either condition 1 or condition 2 (one or
the other) is always being met so condition 3 NEVER gets evaluated.

You have an overlap in your conditions at 7:00. You only need 2
conditions.

Try these:

Condition 1 - GREEN (between 14:00 and 6:59 inclusive)

=AND(ISNUMBER(cell_ref),OR(cell_ref=TIME(14,0,0), cell_ref<TIME(7,0,0)))

Condition 2 - RED (between 7:00 and 13:59 inclusive)

=AND(cell_ref=TIME(7,0,0),cell_ref<=TIME(13,59,0) )



--
Biff
Microsoft Excel MVP


"Waitsu" wrote in message
...
I want to perform a conditional formating in Excel that says:

If the time is between 07:00 and 13:59 then turn the cell border red
and
turn the font red.

if the time is between 14:00 and 07:00 turn the cell green.
Condition 1
This works to turn the cell green: =$F$4<=$E$4

Condition 2
This works to change the font red: =$F$4=$E$4

Condition 3
This does not turn the cell green: =$F$4TIME(14,0,0)


Does anyone have any idea on how can I code this so that it will work?

Thanks






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
Converting date/time serial values to cumulative time totals... Kevin B Excel Discussion (Misc queries) 4 October 18th 07 05:05 PM
Fun with Time values wisperc Excel Discussion (Misc queries) 1 January 5th 06 02:51 AM
Calculating days & time left from start date/time to end date/time marie Excel Worksheet Functions 7 December 7th 05 02:36 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
need help with - time values... rvnwdr Excel Discussion (Misc queries) 2 June 1st 05 01:25 PM


All times are GMT +1. The time now is 03:27 PM.

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

About Us

"It's about Microsoft Excel"