From: Simon Lloyd on

Thanks Bob! :)
Bob Phillips;532660 Wrote:
> Try
>
> =IF(AND(MOD(D1,1)>--"07:00:00",MOD(D1,1)<--"19:00:00"),"Days","Nights")
>
> --
> __________________________________
> HTH
>
> Bob
>
> "Simon Lloyd" <Simon.Lloyd.40enji(a)thecodecage.com> wrote in message
> news:Simon.Lloyd.40enji(a)thecodecage.com...
> >
> > Hi all,
> > I'm having a little trouble with this formula: (D1 is formatted
> =Now())
> > =IF(OR(D1>TIMEVALUE("07:00"),D1<TIMEVALUE("19:00")),"Days","Nights")
> > i also tried:
> >
> =IF(OR(TEXT(D2,"hh:mm")>"07:00",TEXT(D2,"hh:mm")<"19:00"),"Days","Nights")
> > And
> > =IF(OR(D1>--"07:00",D1<--"19:00"),"Days","Nights")
> > But the result is always "Days", all i'm looking to check is if the
> > time now (time of opening the workbook or activating a sheet but
> thats
> > not important) is in between 7am and 7pm, if it is display the word
> > "Days" if not "Nights"
> >
> >
> > --
> > Simon Lloyd
> >
> > Regards,
> > Simon Lloyd
> > 'Microsoft Office Help' ('The Code Cage - Microsoft Office Help -
> Microsoft Office Discussion' (http://www.thecodecage.com))
> >
> ------------------------------------------------------------------------
> > Simon Lloyd's Profile:
> > 'The Code Cage Forums - View Profile: Simon Lloyd'
> (http://www.thecodecage.com/forumz/member.php?userid=1)
> > View this thread:
> > 'Check if time falls between two times? - The Code Cage Forums'
> (http://www.thecodecage.com/forumz/showthread.php?t=146366)
> >


--
Simon Lloyd

Regards,
Simon Lloyd
'Microsoft Office Help' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/showthread.php?t=146366