+ Reply to Thread
Results 1 to 22 of 22

Help with conditional formatting a cell if its date is older than 2 hours.

  1. #1
    Registered User
    Join Date
    01-01-2014
    Location
    here
    MS-Off Ver
    Excel 2007
    Posts
    17

    Help with conditional formatting a cell if its date is older than 2 hours.

    This should be easy to someone smarter then me, but its whipped my butt =o)

    My explanation may be overkill, but I want to make sure Im clear.

    I have cells A1 to H151 reserved, and blank. I copy a form from another place(website), and paste it in cell A1. When I do this, those reserved cells fill with information. I then have cells M1-X53 preset with formulas to take information from cells A1-H151, and display what information is needed the way I want it to display. Basically this spreadsheet takes a poorly written form, and organizes it in a more efficient way.

    Column W tells the time/date from the form for each individual rows data. For example..

    W2 displays the forms data that was found on F2.
    W5 displays the forms data that was found on F5.
    W50 displays the forms data that was found on F50.
    And so on and so forth.

    I have formatted the cells in column W to take the original format (1/1/2014 18:45) from the form, and display it (6:45 PM)

    Here is where I need your help guys!!

    This form updates every half hour, and I re-feed the form when I need to get current "readings"... However, sometimes one of the rows wont update, and will still be the reading the time from earlier. Sometimes this can happen for MANY hours.

    I would love your help in figuring out how to have my spreadsheet look at the time in column W for each row, and if it is >= 2 HOURS OLDER than RIGHT NOW, then to turn that whole row (from M-X) RED

    Can this be done? If so I would desperately appreciate your help! Ive already wrote another format to turn the row black if a different column returns value of 0, and it works perfectly, but figuring out the whole compare the time thing is more then I can figure out.

    Thank you in advance!!!!

    -Shane

  2. #2
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: Help with conditional formatting a cell if its date is older than 2 hours.

    Hi Shane

    select the range of cells you want to apply the conditional format to, then in conditional formatting apply this formula:

    Please Login or Register  to view this content.
    (assuming your selection starts in cell W1 - otherwise modify to indicate the first row)

    then select the fill colour you want

    This will not update automatically, so you will need to press F9 or otherwise recalculate the sheet for the formats to kick in

  3. #3
    Registered User
    Join Date
    01-01-2014
    Location
    here
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Help with conditional formatting a cell if its date is older than 2 hours.

    ok im confused now... this code works perfectly if I create a new sheet, and test it out... but it doesn't in my sheet... what could be wrong?

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Help with conditional formatting a cell if its date is older than 2 hours.

    While applying the CF the active cell should be in 1st row since NickyC's formula refers to the 1st row (=$W1<MOD(NOW(),1)-1/12)


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  5. #5
    Registered User
    Join Date
    01-01-2014
    Location
    here
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Help with conditional formatting a cell if its date is older than 2 hours.

    i changed the code to $W2 since the first cell to be analyzed is w2

  6. #6
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Help with conditional formatting a cell if its date is older than 2 hours.

    While applying the CF, in your selection the activecell should be in the row to which your current CF formula refers to...

  7. #7
    Registered User
    Join Date
    01-01-2014
    Location
    here
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Help with conditional formatting a cell if its date is older than 2 hours.

    for example:
    form cell with actual time stamp = F1
    display cell is W2, the formula in that cell says "=F1" <-----this is the cell I want to CF
    so I highlight w2, click CF, New Rule, "use formula to determine cells to format, paste "=$W2<MOD(NOW(),1)-1/12", select format background of red, and OK

  8. #8
    Registered User
    Join Date
    01-01-2014
    Location
    here
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Help with conditional formatting a cell if its date is older than 2 hours.

    its not hurting that i have another rule target in another column is it?

  9. #9
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Help with conditional formatting a cell if its date is older than 2 hours.

    May be click stop if true for the first CF and check

  10. #10
    Registered User
    Join Date
    01-01-2014
    Location
    here
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Help with conditional formatting a cell if its date is older than 2 hours.

    correction, now its not working at all on my test sheet either, and clicking that didn't do anything

  11. #11
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Help with conditional formatting a cell if its date is older than 2 hours.

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

  12. #12
    Registered User
    Join Date
    01-01-2014
    Location
    here
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Help with conditional formatting a cell if its date is older than 2 hours.

    preparing it now

  13. #13
    Registered User
    Join Date
    01-01-2014
    Location
    here
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Help with conditional formatting a cell if its date is older than 2 hours.

    sdsadasd.xlsx

    Does that work?

  14. #14
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Help with conditional formatting a cell if its date is older than 2 hours.

    May be this

    =$W2<(NOW()-TIME(2,0,0))

  15. #15
    Registered User
    Join Date
    01-01-2014
    Location
    here
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Help with conditional formatting a cell if its date is older than 2 hours.

    thanks for looking, but no... that changes regardless of the time.

  16. #16
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Help with conditional formatting a cell if its date is older than 2 hours.

    Final touch

    =VALUE(TEXT(W2,"HH:MM:SS"))<VALUE(TEXT(NOW()-TIME(2,0,0),"HH:MM:SS"))

  17. #17
    Registered User
    Join Date
    01-01-2014
    Location
    here
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Help with conditional formatting a cell if its date is older than 2 hours.

    a no go on that too... any other ideas? (and thank you)

  18. #18
    Registered User
    Join Date
    01-01-2014
    Location
    here
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Help with conditional formatting a cell if its date is older than 2 hours.

    Im working on a formula, but it just isnt working..


    How do I say..

    if x <= (NOW()-TIME(2,0,0)) then change background

    in excel lol!

  19. #19
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Help with conditional formatting a cell if its date is older than 2 hours.

    Quote Originally Posted by xesvuli420 View Post
    How do I say..
    if x <= (NOW()-TIME(2,0,0)) then change background
    That's what I given in Post #16, just refer it

  20. #20
    Registered User
    Join Date
    01-01-2014
    Location
    here
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Help with conditional formatting a cell if its date is older than 2 hours.

    im sorry buddy, but it didnt work. I do appreciate your help though.

    I ended up having to make a cell with "=now()-time(2,0,0)", making the text clear, and referencing it with CF. For Ex:

    In cell J1 I put

    =now()-time(2,0,0)

    Then in the Display section I wrote a CF saying

    =$W2<$J$1

    Then I applied that to my entire display section... and BINGO! it works like a champ!!!

    Thank you guys for all your help!!!

  21. #21
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Help with conditional formatting a cell if its date is older than 2 hours.

    Glad you fixed it and thanks for the feedback

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  22. #22
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Help with conditional formatting a cell if its date is older than 2 hours.

    Perhaps the condition is reversed:
    =MOD($W2,1)>(MOD(NOW(),1)+1/12)

    Edit: it appears you do wish the date included therefore this is incorrect.
    Last edited by Izandol; 01-02-2014 at 06:43 AM.
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

+ 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. [SOLVED] Conditional Formatting. Anything 4.5 years old + older from todays date needs Highlight.
    By themanwithnoshoes in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-25-2012, 11:58 AM
  2. [SOLVED] Using Conditional Formatting to Highlight Cells When Date/Time is 12 & 18 Hours Later
    By redogue in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-31-2012, 10:53 AM
  3. Replies: 4
    Last Post: 08-04-2011, 05:51 PM
  4. Conditional Formatting Today and Older
    By ConsbruckR in forum Excel General
    Replies: 7
    Last Post: 03-18-2009, 04:31 PM
  5. [SOLVED] conditional formatting ... shade cell ... older than today
    By Mirsten Choiple in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-25-2005, 10:07 AM

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