ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   :confused: Nested if then else statement (https://www.excelbanter.com/excel-worksheet-functions/91011-confused-nested-if-then-else-statement.html)

polk383

:confused: Nested if then else statement
 

Hello All!
I never tried to do anything like this before so here goes! I am
trying to create a nested if then else statement. What I have is 7
fields one of which I created the other 6 where exported data. In the
6th field I have times in there that is subtracting a from fields B and
C. In field H There are times in the format [h]:mm:ss. I need to have
a statement showing that if the time is below 1:00:00 then in the cell
will be "less than 1 hour" if it is between 2 - 4 hours it will say
"between 2 - 4 hours" and if it is over 4 hours then it will show "Over
4 hours" Here is what I have created so far and I am unable to get this
thing to function correctly.


Code:
--------------------
=IF(H2<1:00:00,"Less than 1 hour",IF(H22:00:00,"Over 2 hours",IF(H24:00:00,"Over four hours")))
--------------------


I am at a loss to get this thing to see between 2 - 4 hours and just to
get it to function correctly!

Thanks everyone!!


--
polk383
------------------------------------------------------------------------
polk383's Profile: http://www.excelforum.com/member.php...o&userid=34884
View this thread: http://www.excelforum.com/showthread...hreadid=546286


daddylonglegs

:confused: Nested if then else statement
 

What if the time is between 1 and 2 hours? Perhaps something like this

=IF(H2<"1:00:00"+0,"Less than 1 hour",IF(H2"4:00"+0,"Over 4
hours",IF(H2"2:00"+0,"Over two hours","between 1 and two hours")))


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


pdberger

:confused: Nested if then else statement
 
Polk --

The problem lies in the 2nd part of your 'if' statement. It doesn't address
what happens between 1 & 2 hours and, if it's ANY time over two hours, then
you only get one answer. You want to keep your 'greater than' or 'less than'
consistent. So you might try:

=IF(H2<1:00:00,"Less than 1 hour",IF(H2<2:00:00,"1 to 2
hours",IF(H2<4:00:00,"2 to 4 hours")))

etc.

HTH

"polk383" wrote:


Hello All!
I never tried to do anything like this before so here goes! I am
trying to create a nested if then else statement. What I have is 7
fields one of which I created the other 6 where exported data. In the
6th field I have times in there that is subtracting a from fields B and
C. In field H There are times in the format [h]:mm:ss. I need to have
a statement showing that if the time is below 1:00:00 then in the cell
will be "less than 1 hour" if it is between 2 - 4 hours it will say
"between 2 - 4 hours" and if it is over 4 hours then it will show "Over
4 hours" Here is what I have created so far and I am unable to get this
thing to function correctly.


Code:
--------------------
=IF(H2<1:00:00,"Less than 1 hour",IF(H22:00:00,"Over 2 hours",IF(H24:00:00,"Over four hours")))
--------------------


I am at a loss to get this thing to see between 2 - 4 hours and just to
get it to function correctly!

Thanks everyone!!


--
polk383
------------------------------------------------------------------------
polk383's Profile: http://www.excelforum.com/member.php...o&userid=34884
View this thread: http://www.excelforum.com/showthread...hreadid=546286



Ardus Petus

:confused: Nested if then else statement
 
=IF(H2TIMEVALUE("4:00:00"),"Over four
hours",IF(H2TIMEVALUE("2:00:00"),"Over 2
hours",IF(H2TIMEVALUE("1:00:00"),"1-2 hours","Less than 1 hour")))

HTH
--
AP

"polk383" a écrit
dans le message de news:
...

Hello All!
I never tried to do anything like this before so here goes! I am
trying to create a nested if then else statement. What I have is 7
fields one of which I created the other 6 where exported data. In the
6th field I have times in there that is subtracting a from fields B and
C. In field H There are times in the format [h]:mm:ss. I need to have
a statement showing that if the time is below 1:00:00 then in the cell
will be "less than 1 hour" if it is between 2 - 4 hours it will say
"between 2 - 4 hours" and if it is over 4 hours then it will show "Over
4 hours" Here is what I have created so far and I am unable to get this
thing to function correctly.


Code:
--------------------
=IF(H2<1:00:00,"Less than 1 hour",IF(H22:00:00,"Over 2
hours",IF(H24:00:00,"Over four hours")))
--------------------


I am at a loss to get this thing to see between 2 - 4 hours and just to
get it to function correctly!

Thanks everyone!!


--
polk383
------------------------------------------------------------------------
polk383's Profile:
http://www.excelforum.com/member.php...o&userid=34884
View this thread: http://www.excelforum.com/showthread...hreadid=546286




polk383

:confused: Nested if then else statement
 

Good deal! I am liking all of these guys thank you very much! :)


--
polk383
------------------------------------------------------------------------
polk383's Profile: http://www.excelforum.com/member.php...o&userid=34884
View this thread: http://www.excelforum.com/showthread...hreadid=546286



All times are GMT +1. The time now is 11:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com