Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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?





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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?




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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






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
Function to calculate the number of years, months and days between Vicky Excel Worksheet Functions 2 July 15th 05 04:27 AM
How do I change months into years? Kara Excel Worksheet Functions 3 April 18th 05 08:10 PM
converting months to years and months??? Marty Excel Discussion (Misc queries) 1 February 18th 05 02:38 AM
years and months [email protected] Excel Worksheet Functions 5 January 8th 05 02:53 PM
function years:months Brock Excel Worksheet Functions 1 December 3rd 04 05:02 PM


All times are GMT +1. The time now is 11:22 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"