ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Use of IF function with years and months (https://www.excelbanter.com/excel-programming/390625-use-if-function-years-months.html)

slacey

Use of IF function with years and months
 
I'm trying to use IF function with Years and Months in the cell being used to
perform logical argument and it does not appear to work.
I am trying to return different answers for a period of more than 2 years.
If numerical data in Cell shows more than 2 years, 0 months, IF true I want
to display "2+ years" if less than 2 years 0 months I want to display "Under
2 Years"
Any suggestions


joel

Use of IF function with years and months
 
Comparing microsoft date are in days. So you can do something like this

if(now() - datevalue("1/3/07") (2 * 365), True, False)

or

if(now() - dateserial(2007, 1, 3) (2 * 365), True, False)

or

if(now() - A3 (2 * 365), True, False)

"slacey" wrote:

I'm trying to use IF function with Years and Months in the cell being used to
perform logical argument and it does not appear to work.
I am trying to return different answers for a period of more than 2 years.
If numerical data in Cell shows more than 2 years, 0 months, IF true I want
to display "2+ years" if less than 2 years 0 months I want to display "Under
2 Years"
Any suggestions


Bob Phillips

Use of IF function with years and months
 
=IF(DATEDIF(A1,A2,"Y")=2,"2+ years","Under 2 years")

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"slacey" wrote in message
...
I'm trying to use IF function with Years and Months in the cell being used
to
perform logical argument and it does not appear to work.
I am trying to return different answers for a period of more than 2 years.
If numerical data in Cell shows more than 2 years, 0 months, IF true I
want
to display "2+ years" if less than 2 years 0 months I want to display
"Under
2 Years"
Any suggestions




joel

Use of IF function with years and months
 
Bob: DATEDIF is not a standard worksheet function for excel 2003. which
version of excel are you using?

"Bob Phillips" wrote:

=IF(DATEDIF(A1,A2,"Y")=2,"2+ years","Under 2 years")

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"slacey" wrote in message
...
I'm trying to use IF function with Years and Months in the cell being used
to
perform logical argument and it does not appear to work.
I am trying to return different answers for a period of more than 2 years.
If numerical data in Cell shows more than 2 years, 0 months, IF true I
want
to display "2+ years" if less than 2 years 0 months I want to display
"Under
2 Years"
Any suggestions





Norman Jones

Use of IF function with years and months
 
Hi Joel,

See Chip Pearson at:

The DATEDIF Function
http://www.cpearson.com/excel/datedif.htm


---
Regards,
Norman



"Joel" wrote in message
...
Bob: DATEDIF is not a standard worksheet function for excel 2003. which
version of excel are you using?




Bob Phillips

Use of IF function with years and months
 
Joel,

I am using , 200, 2002/XP, 2003 and 2007. Although it doesn't appear in
Help, it is still there.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Joel" wrote in message
...
Bob: DATEDIF is not a standard worksheet function for excel 2003. which
version of excel are you using?

"Bob Phillips" wrote:

=IF(DATEDIF(A1,A2,"Y")=2,"2+ years","Under 2 years")

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"slacey" wrote in message
...
I'm trying to use IF function with Years and Months in the cell being
used
to
perform logical argument and it does not appear to work.
I am trying to return different answers for a period of more than 2
years.
If numerical data in Cell shows more than 2 years, 0 months, IF true I
want
to display "2+ years" if less than 2 years 0 months I want to display
"Under
2 Years"
Any suggestions







joel

Use of IF function with years and months
 
Datedif works, but you can't add the function using the insert menu - function.

"Norman Jones" wrote:

Hi Joel,

See Chip Pearson at:

The DATEDIF Function
http://www.cpearson.com/excel/datedif.htm


---
Regards,
Norman



"Joel" wrote in message
...
Bob: DATEDIF is not a standard worksheet function for excel 2003. which
version of excel are you using?






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

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