#1   Report Post  
Posted to microsoft.public.excel.misc
Kev Kev is offline
external usenet poster
 
Posts: 46
Default If statement

Please can someone help me on this, I have been struggling with this for
hours and can't find a solution. I want to display a 1 if the time is before
13:00 and a 2 if the time is between 13:00 and 17:00 and a 3 if the time is
after 17:00 but I cannot get the if statement to give me the correct result
between 13:00 and 17:00. I have tried this but it won't work
=IF((D53*24)<=13,"1",IF(D53*24=13<=17,"2",IF(D53* 24=17,"3")))

a
10:00:28
10:01:30
10:02:47
13:00:02
13:12:57
13:19:25
17:06:52
17:11:27
17:14:27

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default If statement

=IF(D53<--"13:00:00",1,IF(D53<=--"17:00:00",2,3))

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Kev" wrote in message
...
Please can someone help me on this, I have been struggling with this for
hours and can't find a solution. I want to display a 1 if the time is

before
13:00 and a 2 if the time is between 13:00 and 17:00 and a 3 if the time

is
after 17:00 but I cannot get the if statement to give me the correct

result
between 13:00 and 17:00. I have tried this but it won't work
=IF((D53*24)<=13,"1",IF(D53*24=13<=17,"2",IF(D53* 24=17,"3")))

a
10:00:28
10:01:30
10:02:47
13:00:02
13:12:57
13:19:25
17:06:52
17:11:27
17:14:27



  #3   Report Post  
Posted to microsoft.public.excel.misc
Kev Kev is offline
external usenet poster
 
Posts: 46
Default If statement

Sorry Bob, this doesn't work, unfortunatley this just puts a 3 in every cell
including the ones before 13:00. BTW what does the -- indicate?

"Bob Phillips" wrote:

=IF(D53<--"13:00:00",1,IF(D53<=--"17:00:00",2,3))

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Kev" wrote in message
...
Please can someone help me on this, I have been struggling with this for
hours and can't find a solution. I want to display a 1 if the time is

before
13:00 and a 2 if the time is between 13:00 and 17:00 and a 3 if the time

is
after 17:00 but I cannot get the if statement to give me the correct

result
between 13:00 and 17:00. I have tried this but it won't work
=IF((D53*24)<=13,"1",IF(D53*24=13<=17,"2",IF(D53* 24=17,"3")))

a
10:00:28
10:01:30
10:02:47
13:00:02
13:12:57
13:19:25
17:06:52
17:11:27
17:14:27




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 618
Default If statement

Your syntax error is at
IF(D53*24=13<=17,...
where, if you needed that condition, it would need to be
IF(AND(D53*24=13,D53*24<=17),...
but you don't need =13 when you've already trapped <=13 in the previous
test.

Try =IF((D53*24)<=13,"1",IF(D53*24<=17,"2","3"))

Also bear in mind that your answers "1", "2", "3" are text. if you want
them as numbers, remove the double quotes.
--
David Biddulph

"Kev" wrote in message
...
Please can someone help me on this, I have been struggling with this for
hours and can't find a solution. I want to display a 1 if the time is
before
13:00 and a 2 if the time is between 13:00 and 17:00 and a 3 if the time
is
after 17:00 but I cannot get the if statement to give me the correct
result
between 13:00 and 17:00. I have tried this but it won't work
=IF((D53*24)<=13,"1",IF(D53*24=13<=17,"2",IF(D53* 24=17,"3")))

a
10:00:28
10:01:30
10:02:47
13:00:02
13:12:57
13:19:25
17:06:52
17:11:27
17:14:27



  #5   Report Post  
Posted to microsoft.public.excel.misc
Kev Kev is offline
external usenet poster
 
Posts: 46
Default If statement

Excellent this works now, thanks for your help.

"David Biddulph" wrote:

Your syntax error is at
IF(D53*24=13<=17,...
where, if you needed that condition, it would need to be
IF(AND(D53*24=13,D53*24<=17),...
but you don't need =13 when you've already trapped <=13 in the previous
test.

Try =IF((D53*24)<=13,"1",IF(D53*24<=17,"2","3"))

Also bear in mind that your answers "1", "2", "3" are text. if you want
them as numbers, remove the double quotes.
--
David Biddulph

"Kev" wrote in message
...
Please can someone help me on this, I have been struggling with this for
hours and can't find a solution. I want to display a 1 if the time is
before
13:00 and a 2 if the time is between 13:00 and 17:00 and a 3 if the time
is
after 17:00 but I cannot get the if statement to give me the correct
result
between 13:00 and 17:00. I have tried this but it won't work
=IF((D53*24)<=13,"1",IF(D53*24=13<=17,"2",IF(D53* 24=17,"3")))

a
10:00:28
10:01:30
10:02:47
13:00:02
13:12:57
13:19:25
17:06:52
17:11:27
17:14:27






  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default If statement

It doesn't, it puts 1, 2 or 3 depending upon the TIME value in D53.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Kev" wrote in message
...
Sorry Bob, this doesn't work, unfortunatley this just puts a 3 in every

cell
including the ones before 13:00. BTW what does the -- indicate?

"Bob Phillips" wrote:

=IF(D53<--"13:00:00",1,IF(D53<=--"17:00:00",2,3))

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Kev" wrote in message
...
Please can someone help me on this, I have been struggling with this

for
hours and can't find a solution. I want to display a 1 if the time is

before
13:00 and a 2 if the time is between 13:00 and 17:00 and a 3 if the

time
is
after 17:00 but I cannot get the if statement to give me the correct

result
between 13:00 and 17:00. I have tried this but it won't work
=IF((D53*24)<=13,"1",IF(D53*24=13<=17,"2",IF(D53* 24=17,"3")))

a
10:00:28
10:01:30
10:02:47
13:00:02
13:12:57
13:19:25
17:06:52
17:11:27
17:14:27






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
SQL concatenation statement CLamar Excel Discussion (Misc queries) 0 June 29th 06 01:58 PM
SET statement tutorial Daminc Excel Discussion (Misc queries) 13 January 17th 06 04:47 PM
If statement Matt Montagliano Excel Discussion (Misc queries) 1 September 8th 05 08:47 PM
Do I need a sumif or sum of a vlookup formula? PeterB Excel Worksheet Functions 0 June 1st 05 12:23 PM
How do I fix a circular reference in a financial statement? drjayhawk25 Excel Discussion (Misc queries) 0 February 7th 05 05:19 PM


All times are GMT +1. The time now is 12:54 PM.

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

About Us

"It's about Microsoft Excel"