Forum Discussion

TKelly445's avatar
TKelly445
Copper Contributor
Jun 29, 2020

If now()

Hi

 

I would like to make a formula with conditions:

 

if the time now is greater than 1 pm show cell A2 but if it is later than 1pm show B2

I have tried the below but cannot work out why it is not working:

 

=IF(NOW()="","",IF(NOW()>(--"1 PM"),A2, B2))

 

Thanks

5 Replies

  • mtarler's avatar
    mtarler
    Silver Contributor

    TKelly445  the 'NOW' function returns a value based on date and time.  Maybe use this:

     

    =IF(NOW()="","",IF(HOUR(NOW())>12,A2, B2))

    that said I don't know why you have NOW()="" condition as that will always be false and recommend removing it and make it =IF(HOUR(NOW())>12,A2,B2) .  I also assume you want A2 for >=1PM and B2 for < 1PM as you had in your formula even though your text was confusing in saying both >1PM

     

      • mtarler's avatar
        mtarler
        Silver Contributor

        TKelly445  you can use a variation of SergeiBaklan  and use 13.5/24 instead of 13.  Or the following if that it more readable for you:

        =IF(MOD(NOW(),1)*24 > --"1:30 PM", A2, B2)

         

Resources