+ Reply to Thread
Results 1 to 14 of 14

Formula for highlighting a cell when time equals NOW

  1. #1
    Registered User
    Join Date
    09-28-2018
    Location
    El Salvador
    MS-Off Ver
    365
    Posts
    21

    Formula for highlighting a cell when time equals NOW

    Hello again guys, first of all I would like to thank you in advance for the help.

    Lately, I have been trying to improve the formula for highlighting a cell when time= NOW, which has been very helpful. However, since a lot of people is coming to the company, I am having difficulties with adding everyone's information because I have to do it manually. Basically, the rule I am following is "show the status a person should be (available, break, lunch, off) when time=NOW ()" in other words, IF "T3:Z64" of 'Schedules!'= Now() THEN apply the custom formula. I'm sorry if I am not being clear. Please don't hesitate to ask. See the attached file for references.

    Thanks in advance,
    Attached Files Attached Files

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Formula for highlighting a cell when time equals NOW

    I got an error opening your file and it made repairs, so just use the attached as an example.

    Apply the following conditional formatting rule to range T3:Z63:

    =AND(NOW()>=$S3+T3,NOW()<$S4+T4)

    Also, note that you show 3/24 as Monday but it's Sunday.

    NOTE: NOW does not automatically update constantly. To refresh your highlighting you must press F9.
    Attached Files Attached Files
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    09-28-2018
    Location
    El Salvador
    MS-Off Ver
    365
    Posts
    21

    Re: Formula for highlighting a cell when time equals NOW

    Thank you for your answer Jeff, it is much appreciated. I opened the file, and it highlights cells with times that have even passed already.

    Here is the formula I am trying to use with my principle =AND('cell name'<>"OFF",MOD(NOW(),1)>='cell name',MOD(NOW(),1)<='time value in numbers')

    Basically the condition is when the value of the text is not equal to 'off'apply the mod of now().

    So, what I am trying to do is instead of putting a cell name to the formula, I would like the formula to refer to the whole sheet.
    For example, when it's 6 AM, employee 1 has to be available and show green on the Diagram 1 sheet.

    I've been trying with an IF function (IF([Diagram Scheme Practice]Schedules'T3:Z64!") to refer to the condition, but it does not work.

  4. #4
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Formula for highlighting a cell when time equals NOW

    Here's an alternative method that works, output in AI:AJ. The table in AL:AM is there to convert the status from column R into something more meaningful.

    Note that AI1 does not contain a NOW() formula, it contains a formula that gives random days from the dates in column S and random times between 05:00 and 17:00 at 5 minute intervals. I've done this so that you can test it easier by recalculating the sheet with f9.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    09-28-2018
    Location
    El Salvador
    MS-Off Ver
    365
    Posts
    21

    Re: Formula for highlighting a cell when time equals NOW

    Thanks for the help Jason, I have reviewed the file, and thanks for the help. I was looking at diagram, but I do not see the status the employees should be, I applied your formula as a conditional formatting too but still nothing happens.

  6. #6
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Formula for highlighting a cell when time equals NOW

    There is nothing in the diagram sheet, that can be deleted, it is all done in the other one.

    That's why I said it was an alternative, because it's not exactly what you asked for, but a simplified alternative.

  7. #7
    Registered User
    Join Date
    09-28-2018
    Location
    El Salvador
    MS-Off Ver
    365
    Posts
    21

    Re: Formula for highlighting a cell when time equals NOW

    Thanks for the response Jason, this definitely helps me with my goal. I will check it out and will mark as solved if it works. Thanks again Jason and Jeff.

  8. #8
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Formula for highlighting a cell when time equals NOW

    You're welcome!

    Just a quick reminder that you will need to change 1 thing before it will work in real time. The formula in AI1 is creating random times for testing, you will need to replace it with =NOW() for it to work with the current time.

    Also, as Jeff pointed out earlier, you will need to refresh the sheet with f9 for =NOW() to update, it is not a constant refresh.

  9. #9
    Registered User
    Join Date
    09-28-2018
    Location
    El Salvador
    MS-Off Ver
    365
    Posts
    21

    Re: Formula for highlighting a cell when time equals NOW

    So I changed the AI1 formula from =RANDBETWEEN(S3,S3+6)+(1/288)*RANDBETWEEN(60,204) to =NOW(). Unfortunately, it is not working anymore. When I was using the randomizer it worked perfectly, but with the now formula, it doesn't. Additionally, I used the TODAY() function also. Thanks in advance.

  10. #10
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Formula for highlighting a cell when time equals NOW

    What would you expect now that you have entered the NOW() function?

    There is no data for today in column S, so the results will be blank.

    After 05:00 tomorrow morning, Agent 6 will show as available, (date in S3 + time in T3), with the rest showing up at the scheduled times.

  11. #11
    Registered User
    Join Date
    09-28-2018
    Location
    El Salvador
    MS-Off Ver
    365
    Posts
    21

    Re: Formula for highlighting a cell when time equals NOW

    Thanks for responding. I'm sorry if I ask too much questions, I am new at using excel for workforce management. I honestly don't understand how the NOW() formula can apply to the data on S so that I get the status on real time.

  12. #12
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Formula for highlighting a cell when time equals NOW

    If you look at the formula in AJ3, that is the one that does all of the work, it just uses the NOW() function as a reference point for the current time.

    This is the key part of the formula in AJ3 (for Agent 1)

    ($S$3:$S$64=INT($AI$1))/(INDEX($T$3:$Z$64,0,MATCH($AI3,$T$2:$Z$2,0))<=MOD($AI$1,1))

    The part in red isolates the rows in column S where the date matches the NOW() function.
    The other part isolates the times in the column for the agent that are earlier than NOW()
    INT($AI$1) and MOD($AI$1,1) separate NOW() into date and time respectively so that each can be compared to the relevant parts of the schedule.
    Once the above is done, the AGGREGATE function isolates the last of the times that have already been filtered out as earlier than NOW().
    This then passes the ROW back to INDEX to get the status from column R
    VLOOKUP then passes this through the table in AL:AM to get the meaningful status.
    This is the status that is used by the conditional formatting to highlight availability of the agent.

    Hope that makes sense.

  13. #13
    Registered User
    Join Date
    09-28-2018
    Location
    El Salvador
    MS-Off Ver
    365
    Posts
    21

    Re: Formula for highlighting a cell when time equals NOW

    Thank you for the explanation, so since everything has to match the AI$1$. Then it would be okay if I add the NOW() function on the AI1 cell, right?

  14. #14
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Formula for highlighting a cell when time equals NOW

    Yes, that is correct. Then, tomorrow morning, after 05:00 the statuses will start updating when you hit f9.

+ 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. Formula for If the Sum Equals Zero, leave cell blank
    By knuckledownlacrosse in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-22-2019, 10:22 PM
  2. Looking for function to run a formula if cell equals
    By Monkei in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-31-2017, 12:09 PM
  3. Highlighting Cell Depend On two criteria date and time
    By udprocks in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-16-2016, 05:05 AM
  4. [SOLVED] formula equals cell directly above
    By Lynne...... in forum Excel General
    Replies: 3
    Last Post: 12-12-2014, 03:00 PM
  5. [SOLVED] Cell equals formula OR manual input
    By PDBartlett in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-20-2014, 05:52 AM
  6. [SOLVED] Formula to add 1 to a cell if equals another...
    By muddbog in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-17-2014, 06:38 AM
  7. How run a Macro if cell A1 equals a value derived from a formula
    By Stickleback in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-20-2012, 01:39 PM

Tags for this Thread

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