1<?xml version="1.0" encoding="UTF-8"?> 2 3 4 5<!-- 6 *********************************************************************** 7 * 8 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 9 * 10 * Copyright 2000, 2010 Oracle and/or its affiliates. 11 * 12 * OpenOffice.org - a multi-platform office productivity suite 13 * 14 * This file is part of OpenOffice.org. 15 * 16 * OpenOffice.org is free software: you can redistribute it and/or modify 17 * it under the terms of the GNU Lesser General Public License version 3 18 * only, as published by the Free Software Foundation. 19 * 20 * OpenOffice.org is distributed in the hope that it will be useful, 21 * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 * GNU Lesser General Public License version 3 for more details 24 * (a copy is included in the LICENSE file that accompanied this code). 25 * 26 * You should have received a copy of the GNU Lesser General Public License 27 * version 3 along with OpenOffice.org. If not, see 28 * <http://www.openoffice.org/license.html> 29 * for a copy of the LGPLv3 License. 30 * 31 ************************************************************************ 32 --> 33 34 35 <helpdocument version="1.0"> 36<meta> 37<topic id="textscalc01func_yearfracxml" indexer="include" status="PUBLISH"> 38<title id="tit" xml-lang="en-US">YEARFRAC</title> 39<filename>/text/scalc/01/func_yearfrac.xhp</filename> 40</topic> 41</meta> 42<body> 43<bookmark xml-lang="en-US" branch="index" id="bm_id3148735"><bookmark_value>YEARFRAC function</bookmark_value> 44</bookmark> 45<bookmark xml-lang="en-US" branch="hid/SC_HID_AAI_FUNC_YEARFRAC" id="bm_id3149251" localize="false"/><paragraph role="heading" id="hd_id3148735" xml-lang="en-US" level="2" l10n="U" oldref="196"><variable id="yearfrac"><link href="text/scalc/01/func_yearfrac.xhp">YEARFRAC</link> 46</variable></paragraph> 47<paragraph role="paragraph" id="par_id3150899" xml-lang="en-US" l10n="U" oldref="197"><ahelp hid="HID_AAI_FUNC_YEARFRAC"> The result is a number between 0 and 1, representing the fraction of a year between <emph>StartDate</emph> and <emph>EndDate</emph>.</ahelp></paragraph> 48<paragraph role="heading" id="hd_id3155259" xml-lang="en-US" level="3" l10n="U" oldref="198">Syntax</paragraph> 49<paragraph role="code" id="par_id3155823" xml-lang="en-US" l10n="U" oldref="199">YEARFRAC(StartDate; EndDate; Basis)</paragraph> 50<paragraph role="paragraph" id="par_id3145144" xml-lang="en-US" l10n="U" oldref="200"> 51<emph>StartDate</emph> and <emph>EndDate</emph> are two date values.</paragraph> 52<section id="basis"> 53<paragraph role="paragraph" id="par_id3149954" xml-lang="en-US" l10n="U" oldref="201"> 54<emph>Basis</emph> is chosen from a list of options and indicates how the year is to be calculated.</paragraph> 55<table id="tbl_id3145590"> 56<tablerow> 57<tablecell colspan="" rowspan=""> 58<paragraph role="tablehead" id="par_id3146847" xml-lang="en-US" l10n="U" oldref="202">Basis</paragraph> 59</tablecell> 60<tablecell colspan="" rowspan=""> 61<paragraph role="tablehead" id="par_id3155956" xml-lang="en-US" l10n="U" oldref="203">Calculation</paragraph> 62</tablecell> 63</tablerow> 64<tablerow> 65<tablecell colspan="" rowspan=""> 66<paragraph role="tablecontent" id="par_id3154502" xml-lang="en-US" l10n="U" oldref="204">0 or missing</paragraph> 67</tablecell> 68<tablecell colspan="" rowspan=""> 69<paragraph role="tablecontent" id="par_id3149877" xml-lang="en-US" l10n="U" oldref="205">US method (NASD), 12 months of 30 days each</paragraph> 70</tablecell> 71</tablerow> 72<tablerow> 73<tablecell colspan="" rowspan=""> 74<paragraph role="tablecontent" id="par_id3148766" xml-lang="en-US" l10n="U" oldref="250">1</paragraph> 75</tablecell> 76<tablecell colspan="" rowspan=""> 77<paragraph role="tablecontent" id="par_id3154326" xml-lang="en-US" l10n="U" oldref="206">Exact number of days in months, exact number of days in year</paragraph> 78</tablecell> 79</tablerow> 80<tablerow> 81<tablecell colspan="" rowspan=""> 82<paragraph role="tablecontent" id="par_id3145245" xml-lang="en-US" l10n="U" oldref="251">2</paragraph> 83</tablecell> 84<tablecell colspan="" rowspan=""> 85<paragraph role="tablecontent" id="par_id3155620" xml-lang="en-US" l10n="U" oldref="207">Exact number of days in month, year has 360 days</paragraph> 86</tablecell> 87</tablerow> 88<tablerow> 89<tablecell colspan="" rowspan=""> 90<paragraph role="tablecontent" id="par_id3145297" xml-lang="en-US" l10n="U" oldref="252">3</paragraph> 91</tablecell> 92<tablecell colspan="" rowspan=""> 93<paragraph role="tablecontent" id="par_id3148394" xml-lang="en-US" l10n="U" oldref="208">Exact number of days in month, year has 365 days</paragraph> 94</tablecell> 95</tablerow> 96<tablerow> 97<tablecell colspan="" rowspan=""> 98<paragraph role="tablecontent" id="par_id3151022" xml-lang="en-US" l10n="U" oldref="253">4</paragraph> 99</tablecell> 100<tablecell colspan="" rowspan=""> 101<paragraph role="tablecontent" id="par_id3150931" xml-lang="en-US" l10n="U" oldref="209">European method, 12 months of 30 days each</paragraph> 102</tablecell> 103</tablerow> 104</table> 105</section> 106<paragraph role="heading" id="hd_id3145626" xml-lang="en-US" level="3" l10n="U" oldref="210">Example</paragraph> 107<paragraph role="paragraph" id="par_id3149007" xml-lang="en-US" l10n="CHG" oldref="211">What fraction of the year 2008 lies between 2008-01-01 and 2008-07-01?</paragraph> 108<paragraph role="code" id="par_id3154632" xml-lang="en-US" l10n="CHG" oldref="212">=YEARFRAC("2008-01-01"; "2008-07-01";0) returns 0.50.</paragraph> 109</body> 110</helpdocument> 111