ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   NESTED IF STATEMENT USING DATE (https://www.excelbanter.com/new-users-excel/147058-nested-if-statement-using-date.html)

SSJ

NESTED IF STATEMENT USING DATE
 
Hello!

Can some review the following IF statement. The error is stating that there are too many arguments.

=IF((TEXT((D2),"yyyy")="2007"),"2007",if(TEXT(d2), "yyyy")="2006","2006","2005 & Before")



If the year of the date is 2007, state "2007", If the year of the date is 2006, state "2006", otherwise state "2005 & Before"



Thanks in advance



SJ


Mike H

NESTED IF STATEMENT USING DATE
 
Try

=IF(TEXT(D2,"yyyy")="2007",2007,IF(TEXT(A13,"yyyy" )="2006",2006,2005 & "
Before"))

Mike

"SSJ" wrote:

Hello!

Can some review the following IF statement. The error is stating that there are too many arguments.

=IF((TEXT((D2),"yyyy")="2007"),"2007",if(TEXT(d2), "yyyy")="2006","2006","2005 & Before")



If the year of the date is 2007, state "2007", If the year of the date is 2006, state "2006", otherwise state "2005 & Before"



Thanks in advance



SJ


Max

NESTED IF STATEMENT USING DATE
 
As posted, the formula had an error in this part:
...if(TEXT(d2),"yyyy")="2006"

which should have been:
...IF(TEXT(D2,"yyyy")="2006"

As-is, corrected with an additional IF to check that D2 isn't blank:
=IF(D2="","",IF((TEXT((D2),"yyyy")="2007"),"2007", IF(TEXT(D2,"yyyy")="2006","2006","2005
& Before")))

Alternatively, a slightly shorter version which yields the same results:
=IF(D2="","",IF(YEAR(D2)<=2005,"2005 & before",TEXT(D2,"yyyy")))
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"SSJ" wrote in message
...
Hello!

Can some review the following IF statement. The error is stating that there
are too many arguments.

=IF((TEXT((D2),"yyyy")="2007"),"2007",if(TEXT(d2), "yyyy")="2006","2006","2005
& Before")

If the year of the date is 2007, state "2007", If the year of the date is
2006, state "2006", otherwise state "2005 & Before"

Thanks in advance



SJ



SSJ

NESTED IF STATEMENT USING DATE
 
Thank you Mike. With a slight correction it worked.

SJ
"Mike H" wrote in message
...
Try

=IF(TEXT(D2,"yyyy")="2007",2007,IF(TEXT(A13,"yyyy" )="2006",2006,2005 & "
Before"))

Mike

"SSJ" wrote:

Hello!

Can some review the following IF statement. The error is stating that
there are too many arguments.

=IF((TEXT((D2),"yyyy")="2007"),"2007",if(TEXT(d2), "yyyy")="2006","2006","2005
& Before")



If the year of the date is 2007, state "2007", If the year of the date is
2006, state "2006", otherwise state "2005 & Before"



Thanks in advance



SJ




SSJ

NESTED IF STATEMENT USING DATE
 
Max,

Your shorter version was what i was looking for!

Thanks

SJ
"Max" wrote in message
...
As posted, the formula had an error in this part:
..if(TEXT(d2),"yyyy")="2006"

which should have been:
..IF(TEXT(D2,"yyyy")="2006"

As-is, corrected with an additional IF to check that D2 isn't blank:
=IF(D2="","",IF((TEXT((D2),"yyyy")="2007"),"2007", IF(TEXT(D2,"yyyy")="2006","2006","2005
& Before")))

Alternatively, a slightly shorter version which yields the same results:
=IF(D2="","",IF(YEAR(D2)<=2005,"2005 & before",TEXT(D2,"yyyy")))
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"SSJ" wrote in message
...
Hello!

Can some review the following IF statement. The error is stating that
there are too many arguments.

=IF((TEXT((D2),"yyyy")="2007"),"2007",if(TEXT(d2), "yyyy")="2006","2006","2005
& Before")

If the year of the date is 2007, state "2007", If the year of the date is
2006, state "2006", otherwise state "2005 & Before"

Thanks in advance



SJ





Don Guillett

NESTED IF STATEMENT USING DATE
 
If d2 is a properly formatted date then this works.

=IF(YEAR(D2)2005,YEAR(D2),"2005 & before")

--
Don Guillett
SalesAid Software

"SSJ" wrote in message ...
Hello!

Can some review the following IF statement. The error is stating that there are too many arguments.

=IF((TEXT((D2),"yyyy")="2007"),"2007",if(TEXT(d2), "yyyy")="2006","2006","2005 & Before")



If the year of the date is 2007, state "2007", If the year of the date is 2006, state "2006", otherwise state "2005 & Before"



Thanks in advance



SJ


Max

NESTED IF STATEMENT USING DATE
 
welcome ..
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"SSJ" wrote in message
...
Max,

Your shorter version was what i was looking for!

Thanks

SJ





All times are GMT +1. The time now is 03:29 AM.

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