Difference between revisions of "Documentation/How Tos/Calc: YEARS function"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (Robot: Automated text replacement %s)
m
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
__NOTOC__
+
{{DISPLAYTITLE: YEARS function}}
 +
{{Documentation/CalcFunc DateTimeTOC
 +
|ShowPrevNext=block
 +
|PrevPage=Documentation/How_Tos/Calc:_MONTHS_function
 +
|NextPage=Documentation/How_Tos/Calc:_ISLEAPYEAR_function
 +
}}__NOTOC__
  
 
== YEARS ==
 
== YEARS ==
Line 30: Line 35:
 
: returns <tt>'''1'''</tt>. Even though there is only one day between the dates, they lie in different years.
 
: returns <tt>'''1'''</tt>. Even though there is only one day between the dates, they lie in different years.
  
{{Documentation/SeeAlso|
+
=== Issues: ===
 +
* This function is not available in Excel.
 +
 
 +
{{SeeAlso|EN|
 
* [[Documentation/How_Tos/Calc: DAYS function|DAYS]]
 
* [[Documentation/How_Tos/Calc: DAYS function|DAYS]]
 
* [[Documentation/How_Tos/Calc: WEEKS function|WEEKS]]
 
* [[Documentation/How_Tos/Calc: WEEKS function|WEEKS]]
* [[Documentation/How_Tos/Calc: MONTHS function|MONTHS]]'''
+
* [[Documentation/How_Tos/Calc: MONTHS function|MONTHS]]
  
* [[Documentation/How_Tos/Calc: Date & Time functions#Date and Time overview|Date & Time overview]]'''
+
* [[Documentation/How_Tos/Calc: Date & Time functions#Date and Time overview|Date & Time overview]]
  
* [[Documentation/How_Tos/Calc: Date & Time functions|Date & Time functions]]'''
+
* [[Documentation/How_Tos/Calc: Date & Time functions|Date & Time functions]]
  
 
* [[Documentation/How_Tos/Calc: Functions listed alphabetically|Functions listed alphabetically]]
 
* [[Documentation/How_Tos/Calc: Functions listed alphabetically|Functions listed alphabetically]]
 
* [[Documentation/How_Tos/Calc: Functions listed by category|Functions listed by category]]}}
 
* [[Documentation/How_Tos/Calc: Functions listed by category|Functions listed by category]]}}
 
+
[[Category: Documentation/Reference/Calc/Date and Time functions]]
=== Issues: ===
+
* This function is not available in Excel.
+

Latest revision as of 14:07, 30 January 2024



YEARS

Returns the number of years between two dates.

This function is only available if the Analysis AddIn is installed.

Syntax:

YEARS(startdate; enddate; mode)

If mode is 0, YEARS returns the number of whole years between startdate and enddate, day/month to day/month.
If mode is 1, YEARS identifies the year that startdate and enddate each lie in, and returns the difference between those years. In other words it returns YEAR(enddate) - YEAR(startdate)
If startdate is after enddate the result will be negative.

Example:

YEARS("2009-04-03"; "2011-11-17"; 0)

returns 2.

YEARS("2011-02-28"; "2012-02-28"; 0)

returns 1. 2012 is a leap year, but 28th February to 28th February is classed as a whole year.

YEARS("2012-02-29"; "2013-02-28"; 0)

returns 0. 2012 is a leap year, but 29th February to 28th February is not classed as a whole year, even though both dates are the last day of February.

YEARS("2009-04-03"; "2011-11-17"; 1)

returns 2.

YEARS("2009-12-31"; "2010-01-01"; 1)

returns 1. Even though there is only one day between the dates, they lie in different years.

Issues:

  • This function is not available in Excel.



See Also
Retrieved from "https://wiki.openoffice.org/w/index.php?title=Documentation/How_Tos/Calc:_YEARS_function&oldid=259710"
Views
Personal tools
Navigation
Print/export
Tools