Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 829
Default If statement based on time ranges

"Dalena" wrote:
It is working for the first three time ranges, but
the last one is giving me zero for all times entered
in that range (6pm - midnight).
Here is my almost working formula:
=IF(AND(B10TIME(24,0,0),B10<=TIME(6,0,1)),
100%,IF(AND(B10TIME(6,0,1),B10<TIME(12,0,1)),
75%,IF(AND(B10=TIME(12,0,0),B10<TIME(18,0,1)),
50%,IF(AND(B10TIME(18,0,0),B10<TIME(24,0,1)),25%, 0))))


There is no time 24:0:0. Midnight is 0:0:0. So the following is
sufficient:

=IF(B10<=TIME(6,0,1),100%,
IF(B10<TIME(12,0,1),75%,
IF(B10<TIME(18,0,1),50%,25%)))

Note that in the second IF expression, we take advantage of the fact that we
failed the first test. So we know that B10TIME(6,0,1) is true; we do not
need to test it.

Similarly in the third IF expression.

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
If then statement based on time of day Sabosis Excel Programming 3 June 24th 11 01:00 AM
Multiple If Then Statement based on ranges Multiple If, Then statements Excel Worksheet Functions 5 November 18th 09 07:08 PM
IF statement for time based data Daren Excel Worksheet Functions 13 October 22nd 06 04:19 AM
union of named ranges based only on the names of those ranges sloth Excel Programming 3 October 2nd 06 03:18 AM
Using an IF statement on time based data DonB Excel Discussion (Misc queries) 11 December 3rd 05 04:07 AM


All times are GMT +1. The time now is 08:47 AM.

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"