1<?xml version="1.0" encoding="UTF-8"?>
2
3<!--***********************************************************
4 *
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements.  See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership.  The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License.  You may obtain a copy of the License at
12 *
13 *   http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied.  See the License for the
19 * specific language governing permissions and limitations
20 * under the License.
21 *
22 ***********************************************************-->
23
24<helpdocument version="1.0">
25<meta>
26<topic id="textscalc01func_yearfracxml" indexer="include" status="PUBLISH">
27<title id="tit" xml-lang="en-US">YEARFRAC</title>
28<filename>/text/scalc/01/func_yearfrac.xhp</filename>
29</topic>
30</meta>
31<body>
32<bookmark xml-lang="en-US" branch="index" id="bm_id3148735">
33<bookmark_value>YEARFRAC function</bookmark_value>
34</bookmark>
35<bookmark xml-lang="en-US" branch="hid/SC_HID_AAI_FUNC_YEARFRAC" id="bm_id3149251" localize="false"/>
36<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>
37</variable></paragraph>
38<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>
39<paragraph role="heading" id="hd_id3155259" xml-lang="en-US" level="3" l10n="U" oldref="198">Syntax</paragraph>
40<paragraph role="code" id="par_id3155823" xml-lang="en-US" l10n="U" oldref="199">YEARFRAC(StartDate; EndDate; Basis)</paragraph>
41<paragraph role="paragraph" id="par_id3145144" xml-lang="en-US" l10n="U" oldref="200">
42<emph>StartDate</emph> and <emph>EndDate</emph> are two date values.</paragraph>
43<section id="basis">
44<paragraph role="paragraph" id="par_id3149954" xml-lang="en-US" l10n="U" oldref="201">
45<emph>Basis</emph> is chosen from a list of options and indicates how the year is to be calculated.</paragraph>
46<table id="tbl_id3145590">
47<tablerow>
48<tablecell colspan="" rowspan="">
49<paragraph role="tablehead" id="par_id3146847" xml-lang="en-US" l10n="U" oldref="202">Basis</paragraph>
50</tablecell>
51<tablecell colspan="" rowspan="">
52<paragraph role="tablehead" id="par_id3155956" xml-lang="en-US" l10n="U" oldref="203">Calculation</paragraph>
53</tablecell>
54</tablerow>
55<tablerow>
56<tablecell colspan="" rowspan="">
57<paragraph role="tablecontent" id="par_id3154502" xml-lang="en-US" l10n="U" oldref="204">0 or missing</paragraph>
58</tablecell>
59<tablecell colspan="" rowspan="">
60<paragraph role="tablecontent" id="par_id3149877" xml-lang="en-US" l10n="U" oldref="205">US method (NASD), 12 months of 30 days each</paragraph>
61</tablecell>
62</tablerow>
63<tablerow>
64<tablecell colspan="" rowspan="">
65<paragraph role="tablecontent" id="par_id3148766" xml-lang="en-US" l10n="U" oldref="250">1</paragraph>
66</tablecell>
67<tablecell colspan="" rowspan="">
68<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>
69</tablecell>
70</tablerow>
71<tablerow>
72<tablecell colspan="" rowspan="">
73<paragraph role="tablecontent" id="par_id3145245" xml-lang="en-US" l10n="U" oldref="251">2</paragraph>
74</tablecell>
75<tablecell colspan="" rowspan="">
76<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>
77</tablecell>
78</tablerow>
79<tablerow>
80<tablecell colspan="" rowspan="">
81<paragraph role="tablecontent" id="par_id3145297" xml-lang="en-US" l10n="U" oldref="252">3</paragraph>
82</tablecell>
83<tablecell colspan="" rowspan="">
84<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>
85</tablecell>
86</tablerow>
87<tablerow>
88<tablecell colspan="" rowspan="">
89<paragraph role="tablecontent" id="par_id3151022" xml-lang="en-US" l10n="U" oldref="253">4</paragraph>
90</tablecell>
91<tablecell colspan="" rowspan="">
92<paragraph role="tablecontent" id="par_id3150931" xml-lang="en-US" l10n="U" oldref="209">European method, 12 months of 30 days each</paragraph>
93</tablecell>
94</tablerow>
95</table>
96</section>
97<paragraph role="heading" id="hd_id3145626" xml-lang="en-US" level="3" l10n="U" oldref="210">Example</paragraph>
98<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>
99<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>
100</body>
101</helpdocument>
102