ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Conditional format a cell in time increments (https://www.excelbanter.com/excel-discussion-misc-queries/195878-conditional-format-cell-time-increments.html)

Bojames

Conditional format a cell in time increments
 
I have a macro creating a time stamp to a cell "d" once the first cell "c" is
changed. How do I make the cell turn yellow after hours orange after 16 hours
and red after 24 hours?

Pete_UK

Conditional format a cell in time increments
 
With the cell selected, click on Format | Conditional Formatting and
choose Formula Is rather than Cell Value Is in the first box. Put this
formula in the next box:

=cell_ref=1

Then click the Format button, Patterns tab and choose Red, then click
OK. Click Add to set up your next condition, and choose Formula Is and
put this formula in:

=cell_ref=16/24

Click the Format button and choose Orange on the Patterns tab, then
OK. Click Add once more, choose Formula Is and enter this formula:

=cell_ref=8/24

then Format button again and choose Yellow, then OK twice to exit the
dialogue box. cell_ref is the cell you have selected.

You should note that Excel stores times internally as fractions of a
24-hour day, hence the values 1, 16/24 and 8/24 above. I'm guessing 8
hours for the last one, as you missed this out in your post.

Hope this helps.

Pete

On Jul 22, 11:40*pm, Bojames
wrote:
I have a macro creating a time stamp to a cell "d" once the first cell "c" is
changed. How do I make the cell turn yellow after hours orange after 16 hours
and red after 24 hours?



Bojames

Conditional format a cell in time increments
 
YES. Thank you. You are correct on the 8 by the way.

"Pete_UK" wrote:

With the cell selected, click on Format | Conditional Formatting and
choose Formula Is rather than Cell Value Is in the first box. Put this
formula in the next box:

=cell_ref=1

Then click the Format button, Patterns tab and choose Red, then click
OK. Click Add to set up your next condition, and choose Formula Is and
put this formula in:

=cell_ref=16/24

Click the Format button and choose Orange on the Patterns tab, then
OK. Click Add once more, choose Formula Is and enter this formula:

=cell_ref=8/24

then Format button again and choose Yellow, then OK twice to exit the
dialogue box. cell_ref is the cell you have selected.

You should note that Excel stores times internally as fractions of a
24-hour day, hence the values 1, 16/24 and 8/24 above. I'm guessing 8
hours for the last one, as you missed this out in your post.

Hope this helps.

Pete

On Jul 22, 11:40 pm, Bojames
wrote:
I have a macro creating a time stamp to a cell "d" once the first cell "c" is
changed. How do I make the cell turn yellow after hours orange after 16 hours
and red after 24 hours?




Pete_UK

Conditional format a cell in time increments
 
Lucky guess !! - Thanks for the feedback.

Pete

On Jul 23, 2:18*am, Bojames wrote:
YES. Thank you. You are correct on the 8 by the way.



All times are GMT +1. The time now is 02:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com