Search code examples
excelexcel-formulaworksheet-functionexcel-2013

How to delay a formula to be shown for a certain number of hours?


I'm using Excel 2013. In cell D5 I have my date of birth, in cell E5 I have a formula that recognizes if today is my birthday and if it is, it shows YES, if not NO. Now the formula works great BUT the formula MUST NOT show YES before 10 a.m.!

How can I delay that formula so it only shows YES if it's past 10am?

I'm not doing this in VBA because I've got a task to write a formula! Here's the formula:

=IF(TEXT(D5;"d.m.")=TEXT(TODAY();"d.m.");"YES";"NO")

Please can someone write me the delayed formula or tell me what function I should use to delay that formula?


Solution

  • Presumably you only want to show "YES" from 10:00 until midnight on that day?

    You could possibly use HOUR function in conjunction with your current formula, e.g.

    =IF(AND(TEXT(D5;"d.m.")=TEXT(TODAY();"d.m.");HOUR(NOW())>=10);"YES";"NO")

    or perhaps simpler to use DATEDIF for your current date comparison like this:

    =IF(AND(DATEDIF(D5;TODAY();"yd")=0;HOUR(NOW())>=10);"YES";"NO")