+ Reply to Thread
Results 1 to 12 of 12

Conditional formatting a cell colour between specific times

  1. #1
    Registered User
    Join Date
    01-25-2017
    Location
    EDINBURGH
    MS-Off Ver
    7
    Posts
    8

    Conditional formatting a cell colour between specific times

    Hi there, Im trying to create a spreadsheet that is filled out at work at the end of each 12 hour shift. Its basicly just an ongoing table of Brewery tanks and contents etc. I have attached a very basic example of the spreadsheet (the actual spreadsheet is huge, with much more info,, but its at work and im now at home trying to get this worked out).

    All I want is for a cell some where on the current shifts spread sheet to colour green to indicat that this is the sheet the operator should be filling out, so that its a little harder to accidentaly fill out a sheet for the wrong day. I have purposly coloured a cell at the top of the screan as an example of how i would like it to look (although it doesnt have to be the date cell)

    Im hopeing that this can be done and that at 7am tomorrow morning the cell for the next days day sift will automaticaly go green, indicating that we are now to start using the sheet for the next day.

    Can this be done?

    I thought I had it when I set the cell to "format only cells with dates occouring today", but as the shift run from 7am-7pm and 7pm-7am etc this does not work.


    Many thanks in advance!

    David
    Attached Files Attached Files
    Last edited by D4V33; 01-25-2017 at 04:53 PM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Conditional formatting a cell colour between specific times

    Hello and welcome to the forum

    Use a Conditional Format.
    Pick the 'Formula' option and enter

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    where A1 is a cell containing a date.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.92 (24120731))
    Posts
    9,108

    Re: Conditional formatting a cell colour between specific times

    you should be able to use a conditional format formula to test the date and time
    and compare to NOW()

    BUT you would need to add the times into the cells

    Night Shift - 07:00pm
    i assume this starts a 7:00 PM to 7AM

    Day Shift - 07:00am
    and 7am to 7pm

    you could include the time in the cell and just display the date
    and then compare with a conditional format

    i will setup and EDIT here with a sample
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  4. #4
    Registered User
    Join Date
    01-25-2017
    Location
    EDINBURGH
    MS-Off Ver
    7
    Posts
    8

    Re: Conditional formatting a cell colour between specific times

    Quote Originally Posted by Richard Buttrey View Post
    Hello and welcome to the forum

    Use a Conditional Format.
    Pick the 'Formula' option and enter

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    where A1 is a cell containing a date.

    I tried this, but then realised that it didnt work as the shifts run from 7am-7pm and 7pm-7am etc

  5. #5
    Registered User
    Join Date
    01-25-2017
    Location
    EDINBURGH
    MS-Off Ver
    7
    Posts
    8

    Re: Conditional formatting a cell colour between specific times

    Yes that would be great!

    I wouldnt really matter if its was the date cell thats highlighted or not, it just needs somthing to make it a little more dummy proof.

    Thank you

  6. #6
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.92 (24120731))
    Posts
    9,108

    Re: Conditional formatting a cell colour between specific times

    one of the issue is its a merged cell that holds the date
    so its only A2 and that causes an issue

    still looking into - but website crashes

  7. #7
    Registered User
    Join Date
    01-25-2017
    Location
    EDINBURGH
    MS-Off Ver
    7
    Posts
    8

    Re: Conditional formatting a cell colour between specific times

    Keeps crashing on me too.

    It desnt have to be a merged cell, I have just did this as an example of how the spreadsheet is laid out.

    You can happily add a new row somwhere at the top of the page with or without the date.
    Last edited by D4V33; 01-25-2017 at 05:17 PM.

  8. #8
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.92 (24120731))
    Posts
    9,108

    Re: Conditional formatting a cell colour between specific times

    i think this rule should work

    =AND(A2<>"", A2<=NOW(), H2>=NOW())

    But you need to put the times into the cell

    so 25/1/17 07:00 for the day shift
    25/1/17 19:00 for the night shift

    can still just display the date and not the time

    may not want the = in both as it may highlight both cells at 7am or 7pm

    =AND(A2<>"", A2<=NOW(), H2>NOW())

    =now()
    includes the date and time as the system time
    BUT it will only work , when you open the spreadsheet

    a recalculation is needed to update the NOW

    so if they open at 06:58
    it will highlight the night shift
    and then a calc is needed to get the new system time
    otherwise nothing changes at 07:02 or any time until a recalc is started

    try it - put
    =NOW()
    into any cell - and see that you need to edited a cell to calc or F9

    you need VBA to refresh , without touching the spreadsheet

    hope that works
    Attached Files Attached Files
    Last edited by etaf; 01-25-2017 at 05:35 PM.

  9. #9
    Registered User
    Join Date
    01-25-2017
    Location
    EDINBURGH
    MS-Off Ver
    7
    Posts
    8

    Re: Conditional formatting a cell colour between specific times

    Thank you very much, I will give this a try!!

  10. #10
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.92 (24120731))
    Posts
    9,108

    Re: Conditional formatting a cell colour between specific times

    i have edited my previous post - you may want to re-read

  11. #11
    Registered User
    Join Date
    01-25-2017
    Location
    EDINBURGH
    MS-Off Ver
    7
    Posts
    8

    Re: Conditional formatting a cell colour between specific times

    Thats works perfect. Didnt need to change a thing. I altered the times to a couple of minutes ago and it worked a treat!!

    Thank you very much, it is very much appreciated! I have spent hours googling and trying different formulas before thinking "this is over my head" lol

    Cheers again
    Dave

  12. #12
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.92 (24120731))
    Posts
    9,108

    Re: Conditional formatting a cell colour between specific times

    you are welcome

    just in practice - watch the sheet is updated and calc F9 used

    as mentioned

    if they open the sheet at 6:50 in prep to add data - it will use the wrong section - if the next shift opens - ie day shift

    maybe look at the process used and timings
    Last edited by etaf; 01-25-2017 at 06:58 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 6
    Last Post: 04-11-2016, 09:48 AM
  2. Conditional Formatting using 3 colour scale from set cell
    By sgrprice in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-13-2015, 05:12 PM
  3. [SOLVED] Single cell conditional formatting, different formatting at different times
    By namzed in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-18-2014, 07:02 PM
  4. [SOLVED] Count number of times a specific colour is displayed in the cell
    By vignesh805 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-25-2013, 04:45 AM
  5. [SOLVED] Conditional Formatting - Using another cell to specify the colour??
    By lealea1982 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-28-2012, 10:00 AM
  6. Conditional Formatting - Using another cell to specify the colour??
    By lealea1982 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-28-2012, 09:50 AM
  7. Excel 2007 : Conditional formatting specific times
    By namerico in forum Excel General
    Replies: 2
    Last Post: 01-22-2011, 01:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1