Hi,
I'm trying to write an if statement to show "day" if it is between 06:00 and 18:00 and "night" if it is between 18:00 and 06:00.
This is harder for me than perhaps it should be! Any ideas?
Try this:
=IF(OR(A1>0.75,A1<0.25), "Night", "Day")
0.75 is the decimal equivalent of the time formatted as "18:00".
0.25 is the decimal equivalent of the time formatted as "6:00".
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
This works perfectly, but...I was hoping to combine it with a cell containing the now() function, but for some reason it doesn't like that - even when the cell is formatted as hh:mm.
Any ideas?
**EDIT** Fixed this myself, wrapped now() in a mod(now(),1) and it worked. Thanks!
Last edited by drx; 10-17-2011 at 05:38 PM. Reason: Solved
If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks