Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
sd sd is offline
external usenet poster
 
Posts: 9
Default use the current time to return a value

Simple formula? if the time is =07:00:00<15:00:00, G$1. = 1 if time
=15:00:00 < 23:00:00 G$1 = 2 if Time =23:00:00 < 07:00:00 G$1 = 3


I have tried to do this a few different ways and have been
unsuccessful. Could someone help please?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default use the current time to return a value

I assume your time is in cell A1 (change to suit). Enter the following
formula in cell G1:

= IF( OR(A1 23:00:00, A1 < 07:00:00), 3 ,IF( A1 15:00:00, 2, 1 ) )

(Spaces not really necessary - just easier to read)

Pete

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default use the current time to return a value

Sorry, the first greater than should be greater than or equal to,

i.e. change to = for the comparison with 23:00:00

Pete

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default use the current time to return a value

If that doesn't work, try it like this:

= IF( OR(A1 = TIMEVALUE("23:00"), A1 < TIMEVALUE("07:00")), 3,IF( A1 =
TIMEVALUE("15:00"), 2, 1 ) )

--
Regards,
Tom Ogilvy

"Pete" wrote in message
oups.com...
I assume your time is in cell A1 (change to suit). Enter the following
formula in cell G1:

= IF( OR(A1 23:00:00, A1 < 07:00:00), 3 ,IF( A1 15:00:00, 2, 1 ) )

(Spaces not really necessary - just easier to read)

Pete



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default use the current time to return a value


The other thing that can confuse is that if the cell A1 is formatted a
TIME it will display a time even though it has a date. Therefore yo
may need to take the fractional part of cell A1 which can be done b
substituting TIMEVALUE(A1) for the A! in the previous answer.

you can see this in :
timevalue(time)=time which is true and
timevalue(now)=now which is false

hope this help

--
tony
-----------------------------------------------------------------------
tony h's Profile: http://www.excelforum.com/member.php...fo&userid=2107
View this thread: http://www.excelforum.com/showthread.php?threadid=48874

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
return the current row number for use in a formula CuriousMark Excel Discussion (Misc queries) 2 May 6th 08 02:53 AM
Having the current time inserted w/o updating the current time sherobot Excel Worksheet Functions 2 October 2nd 06 05:05 PM
use the current time to return a value [email protected] Excel Discussion (Misc queries) 2 November 28th 05 05:08 PM
Can I automatically enter the current date or current time into a Ben New Users to Excel 7 October 19th 05 03:38 PM
Current time Current date. yo beee Excel Programming 3 July 22nd 04 03:41 AM


All times are GMT +1. The time now is 07:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"