View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
daddylonglegs
 
Posts: n/a
Default Overcome LOOKUP limits and NOW()


edwardpestian Wrote:
So what am I doing wrong here?

The first example using LOOKUP works as expected; however the second
example using VLOOKUP does not

="Good"&"
"&LOOKUP(MOD(NOW(),1),{0,0.5,0.75},{"Morning","Aft ernoon","Evening"})&"
"&"Today Is"&" "&TEXT(TODAY(),"mmmm dd, yyyy")

="Good"&"
"&VLOOKUP(MOD(NOW(),1),{0,"Morning";0.5,"Afternoon ";0.75,"Evening"},2,0)&"
"&"Today Is"&" "&TEXT(TODAY(),"mmmm dd, yyyy")

Thanks.

ep


VLOOKUP with a 4th argument of 0 will allow an unsorted lookup range
but you can only get an exact match, so this formula will only work
when the time is exactly midnight, noon or 6PM. For this situation you
might as well stick with LOOKUP.

BTW you don't need to use "Good"&" "& etc. - you could use "Good "&...


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=555301