Change cell color based on time

I have a row with 24 cells. I want each cell (from left to right) to change color based on the time. Each cell will represent 1 hour A1=Midnight, B2=1AM, etc... At those specific hours I'd like the corresponding cell to change color. So, at midnight, A1 will change from white to red. I figured I could do this with conditional formatting.
I created a table with =NOW() and formatted it to display only the hour. I then created my 24 column row and pointed each cell in that row to that =NOW() cell. Each cell now displayed the current hour. I setup conditional formatting so that, for example, if A2=1AM (as displayed in the cell) then the formatting would change, but this didn't seem to work. I'm guessing the conditional formatting is just seeing the formula and not the value in the cell. Any thoughts here?

There are a couple of issues involved:
1. Conditional formatting rules compare the value in the cell to be formatted to a fixed value or to the value in another cell. If the rule says "=", then the values must be exactly the same.
2. Date and Time values in Numbers always contain both a time component and a date component. Always. The cell may be formatted to display only the time, only the date, or both, but no matter what is displayed, the values are equal only if the complete Date and Time value is the same.
3. "Midnight", "1AM", are text values. They will never be equal to a Date and Time value.
So the problems are to:
• Extract the Hour from the Date and Time value returned by NOW()
• Convert that number to a text value in the form "9AM", "9PM", or optionally "Midnight", and I presume, "Noon"
• Store that changeable value where it may be compared to the value in the cell to be conditionally formatted.
• Construct the rule to format the cell(s).
Row 1 contains a sample of the 24 cells to be formatted.
Columns D and E, rows 2 to 25 are a LOOKUP table, where the HOUR value is looked up and the corresponding text value returned.
F2 (highlighted with an orangeish fill) contains the formula which extracts the HOUR value from NOW(), looks it up and returns the value displayed (and to be compared).
F2: =LOOKUP(HOUR(NOW()),D2:D25,E2:E25)
Regards,
Barry
Edit: Second thought
The LOOKUP table can be avoided using this formula in F2
=OFFSET($A$1,0,HOUR(NOW())-15)
The -15 at the end of the formula works for my sample table, in which column 1 (column A) is 3PM. For column A=Midnight, the shift should be -0 (or just left off).
Message was edited by: Barry

Similar Messages

  • Change cell color of query results,font size,style

    Change cell color of query results,font size,style
    Hello
    I have this code below and I want to know if it is possible
    to make the column header a font style different
    Example:
    Font size =12
    Verdena
    blue
    And the cell of the column name a different color for ex
    Yellow
    Can this be done here and where in this code do I put it??
    Thank you so much
    <cfquery name="gelov datasource="kl90">
    SELECT
    FROM
    WHERE
    ORDER BY
    <cfswitch expression="#Form.orderBy#">
    <cfks value="KSNUMBER">
    KS.KS_NBR
    </cfks>
    <cfks value="CREATIONDATE">
    KS.KREATDAT
    </cfks>
    </cfswitch>
    </cfquery>
    <!---html report--->
    <cfswitch expression="#Form.outputFormat#">
    <cfks value="HTML">
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1" />
    <title>Ctwye Kss Report</title>
    </head>
    <style type="text/css">
    table{
    font-family:Arial, Helvetica, sans-serif;
    font-size:10px;
    td{
    font-family:Arial, Helvetica, sans-serif;
    font-size:10px;
    th{
    font-family:Arial, Helvetica, sans-serif;
    font-size:10px;
    h2{
    font-family:Arial, Helvetica, sans-serif;
    font-size:12px;
    h3{
    font-family:Arial, Helvetica, sans-serif;
    font-size:13px;
    </style>
    <body>
    <cfoutput>
    <table border="0" cellpadding="3" cellspacing="0">
    <tr>
    <td align="center">
    <h3>Ctwye Kss
    Report</h3><br><br></td>
    </tr>
    <tr>
    <td align="center">
    </h2>report returned #getCtwyeKss.RecordCount#
    records</h2></td>
    </tr>
    <tr>
    <td>
    <table border="1" cellpadding="2" cellspacing="0">
    <tr>
    <td width="160">Ks Number</td>
    <td>K-date</td>
    <!--- <td class="dataField">Address</td>
    <td class="dataField">Type</td>
    <td class="dataField">Description</td>--->
    </tr>
    <cfloop query="getCtwyeKss">
    <tr bgcolor="<cfif currentrow mod
    2>GHOSTWHITE<cfelse>WHITE</cfif>">
    <td>#KS_NBR#</td>
    <td>#dateformat(KREATDAT,"mm/dd/yyyy")#</td>
    </tr>
    </cfloop>
    </table>
    </td>
    </tr>
    </table>
    </BODY>
    </HTML>
    </cfoutput>
    </cfks>
    <cfks value="CSV">
    <CFHEADER NAME="Content-Disposition" VALUE="attachment;
    filename=ctwye.csv">
    <cfcontent type="application/msexcel">"Ks
    Number","K-date"
    <cfoutput
    query="getCtwyeKss">#ltrim(KS_NBR)#,"#dateformat(KREATDAT,"mm/dd/yyyy")#"
    <tr #IIF(getCtwyeKss.CurrentRow MOD
    2,DE(''),DE('backgroundColor="##999"'))#>
    <!---<tr bgcolor="<cfif currentrow mod
    2>##808080<cfelse>##ffffff</cfif>"> --->
    </cfoutput>
    </cfks>
    </cfswitch>

    By using <TH> instead of <TD> on your header row
    you can then specify different font type and size in your CSS code.
    th{
    font-family:Arial, Helvetica, sans-serif;
    font-size:12px;
    I'm guessing this is your header?
    <tr>
    <td width="160">Ks Number</td>
    <td>K-date</td>
    <!--- <td class="dataField">Address</td>
    <td class="dataField">Type</td>
    <td class="dataField">Description</td>--->
    </tr>
    If so, change these <TD> to <TH>
    <tr>
    <th width="160">Ks Number</th>
    <th>K-date</th>
    <!--- <th class="dataField">Address</th>
    <th class="dataField">Type</th>
    <th class="dataField">Description</th>--->
    </tr>

  • Mouse over to change cell color

    Can anyone point me to a really good tutorial for doing mouse
    over also
    changes the cell color?.
    Ive tried a few and spent hours on it and just cannot get it
    to work
    correctly.
    Here is my basic starting .css which i start off with each
    time.
    .tnav {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #FFFFFF;
    .tnav a:link {
    color: #FFFFFF;
    font-size: 12px;
    text-decoration: none;
    .tnav a:visited {
    color: #FFFFFF;
    text-decoration: none;
    .tnav a:hover {
    color: #FFFFFF;
    text-decoration: underline;
    .tnav a:active {
    color: #FFFFFF;

    On Thu, 8 Mar 2007 14:42:35 -0000, "Mike"
    <[email protected]> wrote:
    >Can anyone point me to a really good tutorial for doing
    mouse over also
    >changes the cell color?.
    Change your CSS to this:
    .tnav {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #FFFFFF;
    .tnav a {
    color: #FFFFFF;
    display: block;
    text-decoration: none;
    .tnav a:hover {
    color: #FFFFFF;
    text-decoration: underline;
    Add a conditional comment to the <head> of the document
    to correct for
    an IE browser bug:
    <!--[if ie]>
    <style type="text/css">
    .tnav a {
    height: 1%;
    </style>
    <![endif]-->
    Gary

  • ADF Table cell color based on the value in that field

    Dear All,
    I want to create a table for our new application which contains a table used to represent the data in a chart format or matrix format,
    and each cell of the table should be filled with a colour out of three colors, based on the value belongs to which range eg:(1-8 ->green, 9-20 - yellow etc),
    I dont know how to implement this. Please help...
    Ranjith

    Check this out.
    How to highlight ADF table row based on column value?
    -Arun

  • Change Cell Color of JTable-Please Help

    Hi All,
    I want to change the color of a Row in a JTable when i click on it. And After that when i click another row i want to retain this color and give another color to the second row.
    If somebody knows how to do this. Do Help
    Thanks in advance
    -Jeena

    Hi,
    thanks for the fast reply
    Using a TableCellRenderer i was able to give colors to the selected row. But when i click another row the color disappears.
    Thanks,
    Jeena

  • Change cell color in jdbTable?

    Hi, I have a jdbTable ... and the result are a result of a query ...
    jdbTable.setDataSet(queryDataSet);
    the rusult are:
    Name - Surname - child - married
    I'd like to change row color when the married is yes and when the child are > 0
    Is it possible to do it? Because I found only JTable example.
    Thank you very much

    Sorry the component name is wdr_test_table  in view SNGL_MARK_CELL see the method wddoinit( ).
    Regards
    Yash

  • Script to change fill color based on excel data?

    Hi.  I'm curious if there is a way to change the fill color of, say a rectangle, in Illustrator based on data in an excel spreadsheet (csv or whatever).  For example: say the data in the excel cell is 1 and that corresponds to the rectangle in Illustrator having a yellow fill...  Now say I update the data in the cell to 2 and save.  I run the script and it makes the box red.  Is that even remotely possible?  Thanks.

    Hi, yes it's possible, I used VBA on Windows
    Assuming you have an Illustrator file with 1 square, and 2 swatches named "yellow" and "red"
    this is how I set up the excel file
    type the formula in cell F2 as shown, make your color updates on cell E2
    VBA code:
    Sub recolorSquare()
        Dim iapp As New Illustrator.Application
        Dim idoc As Illustrator.Document
        Dim rect As Illustrator.PathItem
        Dim whatColor As String
        whatColor = range("F2")
        Set idoc = iapp.ActiveDocument
        Set rect = idoc.PathItems(1)
        rect.FillColor = idoc.Swatches(whatColor).Color
        Set rect = Nothing
        Set idoc = Nothing
        Set iapp = Nothing
    End Sub

  • [php+mysql] nextensio list: how to change row color based on field content?

    Hi all
    I have a nextensio list on a page.
    is there a way to change the background color of a whore row based on
    a specific field content?
    example I have a field containing the values 0 or 1.
    If the field content is 1 the row background color should be RED.
    ANy suggestion?
    TIA in advance.
    tony

    DataBoundAPI's you can refer to achieve this.
    Search for OLD threads also. Here are some links:
    Can we colour the rows in the column of a table
    Advanced table row font color- result based change.
    Thanks
    --Anil
    http://oracleanil.blogspot.com/

  • Change cell color if number is different from previous cell

    Hello all and thank you in advance for any help that is provided.
    I want to have the color of text in one cell change if the number entered into that cell is higher than the number entered in the previous cell.
    Example: If cell A=18 and cell B=18 then the font color in both cells is the same.
    If cell A=18 and cell B=20 then the color of the font in cell B should change to another color.
    I have done my best to look through the posted questions to no avail so I apologize if this has already been answered.
    AJ

    Inspector > Format (42)
    Select B2 > Conditional format > Greater than > A2 > Edit > Text > Red, Green whatever. Done.
    As usual the format in B2 can be dragged down by the little o bottom right to B3, B4 etc.
    S.

  • ALV Grid display cell color based on value ( Function Module ALV )

    Hi,
    I want to color the cell based on value eg ( Green = Green color, Red = Red color, Amber = Yello color ).
    Each and every cell is editable after displaying on screen. once the user clicks update button the contents has to be saved to a custom table.
    Can anyone help?
    Advance thanks

    Hi,
    <li>To get color for the cell, you need to set EMPHASIZE field with below information while building fieldcatalog.
    emphasize (highlight columns in color)
    value set: SPACE, 'X' or 'Cxyz' (x:'1'-'9'; y,z: '0'=off '1'=on)
    'X' = column is colored with the default column highlight color.
    'Cxyz' = column is colored with a coded color:
    C: Color (coding must begin with C)
    x: color number
    y: bold
    z: inverse
    <li> To edit the fields, you need to set EDIT = 'X' or INPUT= 'X' . Try those .
    wa_fieldcata-input = 'X'.
    <li>you need to set PF status , to do your remaining requirement.
    <li>For any help, you have to search the forum .
    Thanks
    Venkat.O

  • Changing cell colors of Webapplication

    Dear all,
    I want to create a report that does highlights specific cells with colors and/or bold letters.
    The example is:
    I have a keyfigure consumption and a characteristic consumption_type.
    The consumtion_type defines where the consumption occures e.g. facility, block etc.
    Now I want to highlight the consumption value with different colors for the consumption_type e.g. facility=red, block=blue
    The consumption value should be hightlighted and not the type. It would be perfect if the type would not even be shown.
    How can I achive this?
    Thanks,
    Andreas

    Hello Vineet,
    Thank you for your reply.
    That helped me to get an idea of what is possible there.
    I found the following link:
    http://help.sap.com/saphelp_nw04/helpdata/en/96/42393c3eb3036be10000000a11402f/frameset.htm
    So you saying its possible also to remove cells (e.g. consumption_type) which is only needed to indentify the colors but should not be seen in the report?
    I also read in SAP note 931395 that with BW 7.0 it should be possible to manipulate the reports with java (the same that is done now with Abap). Do you have any information about this?
    Thanks,
    Andreas
    Message was edited by:
            Andreas Schuth

  • Change cell colors used within a function

    While using various functions in a spreadsheet I use to track my bills on a monthly basis, the functions do a great job of highlighting all the cells included. The problem is.....I cannot see them well, some not at all, since I am color blind and the palette seems to be a very light, pastel. Is there a way to control the colors used by functions to highlight in more basic colors or darker grays?
    Thanks!

    i,
    Have you explored the contrast enhancement options in System Preferences, Personal, Universal Access, Seeing, Display?
    Regards,
    Jerry

  • Change cell color if MAX

    Hello,
    i want to find the max value in my report column and change the background color of it using field expression.
    Thanks in Advance

    You are putting the expression into the fill color of the appropriate textbox? Altering the column name and data set name as appropriate?
    That expression deffinetly does the job in SSRS 05, 08 and 10.

  • How to change addressbar color based on SSL/SSL-EV/Broken-SSL/No-SSL

    Hello,
    is there any way how to force FF31 to color the address bar background with green for verified SSL, yellow for normal SSL red for broken SSL and white for no SSL? I know FF shows a little icon next to the URL, but I want whole address bar background to display the security mode. The little icon is just not visible enough. I haven't found any addon that could do that. I tried using chrome/userChrome.css but it seems to be broken and cannot properly display all 4 states.
    The following code does not work for "level=low", and I could not test "level=broken" because i do not know of any website to test it on. "level=high" seem to be displayed always when there is a SSL regardless of whether it's "high" (verified) or "low" (not verified).
    Could you please tell me if there is any way to achieve this address bar coloring? Thank you.
    #urlbar[level="high"] {
    background-color: #D0F2C4 !important;
    #urlbar[level="low"] {
    background-color: #FFFFB7 !important;
    #urlbar[level="broken"] {
    background-color: white !important;
    }

    Go to the '''[https://addons.mozilla.org/en-US/firefox/ Mozilla Add-ons Web Page]''' {web link}
    (There’s a lot of good stuff here) and search for what you want.

  • Conditional Formatting - how to change cell colour based on cell value

    I am in the process of moving some Excel spreadsheets into Numbers on my iPad. The Excel spreadsheet had conditional formatting in certain cells. If the cell value was less than a certain amount (<46 for example), the cell background would automatically turn yellow.
    Is there any way to make Numbers on iPad do this?
    Thanks for any help you can provide.
    Scott

    I beleive this is one of those doable tings on desktop that gets taken out on ipad. If you would like to suggest this as an idea for apple to put in, please go to http://www.apple.com/feedback

Maybe you are looking for

  • QT wont play certain files all of a sudden

    I updated my QT 7.2.0 to 7.2.2 and QT wont play my mp4 files, I get an error saying ' movie could not be opened an invalid sample description was found in the movie' . Also it wont play the audio on some formats and I can't get ant audio from youtube

  • How to increase the width of the Fluid Grid Layout from 1008px to 1080px?

    Good day all, I'm experiencing a slight problem with Fluid Grid Layout in Dreamweaver CS6. I want to increase it's width so that it could be one with my Photoshop CS6 design (which is 1080px), the problem is that I can't as I am limited to 1008px. Ho

  • Problem in jsp with container(JEUS)

    Hi I am a developer in Korea Nowadays I have a problem in jsp pages which have contained some pakage directive in a library path so my problem is changing some of the classes in the package during service time. Error result is -Root Exception stack t

  • Dropshadows with white box from logo created illustrator EPS, HELP?

    Does anyone know the best way to keep a dropshadow we created in illustrator for a logo? we have tried a photoshop transparent file, the element created in illustrator (in this case an oval with a blur) and everytime we place in InDesign, we get a wh

  • Why can't I play a synced playlist on my iPad?

    I just synced a playlist (for the first time) to my iPad and the songs show up but they're greyed out and I can't play those songs. How come?