"Bill" wrote...
I'm working on a somewhat complex function trying to have excel
make a choice based on current time. Here is the statement I'm
trying to use:
=IF(AND(NOW()A17,NOW()<A18),
(IF(HLOOKUP(TODAY()-1,$B$1:$T$32,ROW($A$3))="","P",
HLOOKUP(TODAY()-1,$B$1:$T$32,ROW($A$3)))),
(IF(HLOOKUP(TODAY(),$B$1:$T$32,ROW($A$3))="","P ",
HLOOKUP(TODAY(),$B$1:$T$32,ROW($A$3)))))
A17 and A18 will contain time values to create a "window of time"
where I want the current time to either fall within or outside of.
....
. . . If I use static values instead of the
NOW() function the statement seems to work but I need to use
NOW() to correctly interpret the current day/time (I think). Any
ideas how I can accomplish this using the NOW() function??
What do the static values look like? What do A17 and A18 look like?
NOW() returns date and time, so if the A17 and A18 values are only times,
then NOW() will always be greater than the larger of them (so never between
them).
That said, looks like you could simplify your formula to
=IF(HLOOKUP(TODAY()-AND(NOW()A17,NOW()<A18),$B$1:$T$32,ROW($A$3))="",
"P",HLOOKUP(TODAY()-AND(NOW()A17,NOW()<A18),$B$1:$T$32,ROW($A$3)))
|