Difference between revisions of "Manuals/calci/YEARFRAC"

From ZCubes Wiki
Jump to navigation Jump to search
(Created page with "<div id="6SpaceContent" class="zcontent" align="left"> '''YEARFRAC'''(SomeFrom, SomeTo, SomeBasis) where, '''SomeFrom''' - is a date that represents the start date. ...")
 
Line 1: Line 1:
<div id="6SpaceContent" class="zcontent" align="left">
+
=YEARFRAC(SD, ED, basis)=
  
'''YEARFRAC'''(SomeFrom, SomeTo, SomeBasis)
+
where
 +
*<math>SD</math> represents a start date,
 +
*<math>ED</math> represents an end date, and
 +
*<math>basis</math> is the type of day count basis to use.
  
where,
+
YEARFRAC() calculates the fraction of the year depending on the number of days between start date and end date.
  
'''SomeFrom''' - is a date that represents the start date.
+
== Description ==
  
'''SomeTo''' - is a date that represents the end date.
+
YEARFRAC(SD, ED, basis)
  
'''SomeBasis''' - is the type of day count
+
*YEARFRAC() returns the fractional proportion of the year from specified start and end dates.
 +
*<math>SD</math> and <math>ED</math> dates should be entered either in 'date format' or 'dates returned using formulas'. If dates are not valid, Calci displays #N/A error message.
 +
*<math>SD</math> date should be &lt; <math>ED</math>, else Calci displays NaN error message.
 +
*<math>basis</math> value is optional. If omitted, Calci assumes it to be 0.
 +
Below table shows the use of <math>basis</math> values:
  
Basis           Day count
+
{| class="wikitable"
 +
|-
 +
! Basis !! Description
 +
|-
 +
| 0 || US (NASD) 30/360
 +
|-
 +
| 1 || Actual/actual
 +
|-
 +
| 2 || Actual/360
 +
|-
 +
| 3 || Actual/365
 +
|-
 +
| 4 || European 30/360
 +
|}
  
0                 US 30/360
+
*If <math>basis</math> value is other than 0 to 4, Calci displays #N/A error message.
  
1                 Actual/actual
+
== Examples ==
  
2                 Actual/360
+
YEARFRAC(SD, ED, basis) function with inputs in order is calculated as follows:
  
3                 Actual/365
+
<div id="2SpaceContent" class="zcontent" align="left">
  
4                 European 30/360
+
{| id="TABLE3" class="SpreadSheet blue"
 +
|- class="even"
 +
| class="sshl_f" | 1/4/2008
 +
| class="sshl_f" |
  
</div>
+
|- class="odd"
----
+
| class="sshl_f" | 10/10/2008
<div id="1SpaceContent" class="zcontent" align="left">
+
| class="sshl_f" |
  
Calci calculates the fraction of the year between startdate and enddate.
+
|- class="even"
 +
| class="sshl_f" | 4
 +
| class="sshl_f" |
  
</div>
+
|}
----
 
<div id="7SpaceContent" class="zcontent" align="left">
 
 
 
All parameters are truncated to integers.
 
 
 
If SomeBasis &lt; 0 or SomeBasis &gt; 4, YEARFRAC
 
 
 
returns the #ERROR.
 
 
 
</div>
 
----
 
<div id="12SpaceContent" class="zcontent" align="left"><div class="ZEditBox" align="left">
 
 
 
YEARFRAC
 
 
 
<font size="6"></font>
 
 
 
</div></div>
 
----
 
<div id="8SpaceContent" class="zcontent" align="left">
 
 
 
Lets see an example in (Column1, Row4)
 
 
 
<nowiki>=YEARFRAC(R1C1,R2C2,R3C1)</nowiki>
 
 
 
YEARFRAC returns 0.766667
 
  
consider an another example
+
=YEARFRAC(A1,A2,A3) : Calculates the fraction Value of the year with the inputs in the range A1 to A3. Returns '''0.7666666666666667''' as a result.
 +
=YEARFRAC(DATE(2014,1,1),DATE(2014,4,1)) : Calculates the fraction Value of the year within the dates mentioned. Returns '''0.25''' as a result.
 +
=YEARFRAC(DATE(2014,1,1),DATE(2015,4,1)) : Calculates the fraction Value of the year within the dates mentioned. Returns '''1.25''' as a result.
  
<nowiki>=YEARFRAC(DATE(2008,5,4),DATE(2008,6,4),-4)</nowiki>
+
== See Also ==
  
YEARFRAC returns #ERROR.
+
*[[Manuals/calci/YEAR | YEAR]]
  
</div>
+
== References ==
----
 
<div id="10SpaceContent" class="zcontent" align="left"><div class="ZEditBox" align="justify">Syntax </div><div class="ZEditBox"><center></center></div></div>
 
----
 
<div id="4SpaceContent" class="zcontent" align="left"><div class="ZEditBox" align="justify">Remarks </div></div>
 
----
 
<div id="3SpaceContent" class="zcontent" align="left"><div class="ZEditBox" align="justify">Examples </div></div>
 
----
 
<div id="11SpaceContent" class="zcontent" align="left"><div class="ZEditBox" align="justify">Description </div></div>
 
----
 
<div id="2SpaceContent" class="zcontent" align="left">
 
 
 
{| id="TABLE3" class="SpreadSheet blue"
 
|- class="even"
 
| class=" " |
 
| Column1
 
| Column2
 
| Column3
 
| Column4
 
|- class="odd"
 
| class=" " | Row1
 
| class=" " | 1/4/2008
 
|
 
| class="sshl_f    SelectTD  SelectTD ChangeBGColor" |
 
|
 
|- class="even"
 
| class="  " | Row2
 
| class=" " | 10/10/2008
 
|
 
|
 
|
 
|- class="odd"
 
| Row3
 
| class="sshl_f " | 4
 
|
 
|
 
|
 
|- class="even"
 
| Row4
 
| class="sshl_f" | 0.766667
 
|
 
|
 
|
 
|- class="odd"
 
| class=" " | Row5
 
|
 
|
 
|
 
|
 
|- class="even"
 
| Row6
 
|
 
|
 
|
 
|
 
|}
 
  
<div align="left">[[Image:calci1.gif]]</div></div>
+
*[http://en.wikipedia.org/wiki/Date_format_by_country Date Formats]
----
+
*[http://en.wikipedia.org/wiki/Calendar_year Calendar Year]
 +
*[http://en.wikipedia.org/wiki/Day_count_convention Basis Convention]

Revision as of 07:32, 6 February 2014

YEARFRAC(SD, ED, basis)

where

  • represents a start date,
  • represents an end date, and
  • is the type of day count basis to use.

YEARFRAC() calculates the fraction of the year depending on the number of days between start date and end date.

Description

YEARFRAC(SD, ED, basis)

  • YEARFRAC() returns the fractional proportion of the year from specified start and end dates.
  • and dates should be entered either in 'date format' or 'dates returned using formulas'. If dates are not valid, Calci displays #N/A error message.
  • date should be < , else Calci displays NaN error message.
  • value is optional. If omitted, Calci assumes it to be 0.

Below table shows the use of values:

Basis Description
0 US (NASD) 30/360
1 Actual/actual
2 Actual/360
3 Actual/365
4 European 30/360
  • If value is other than 0 to 4, Calci displays #N/A error message.

Examples

YEARFRAC(SD, ED, basis) function with inputs in order is calculated as follows:

1/4/2008
10/10/2008
4
=YEARFRAC(A1,A2,A3) : Calculates the fraction Value of the year with the inputs in the range A1 to A3. Returns 0.7666666666666667 as a result.
=YEARFRAC(DATE(2014,1,1),DATE(2014,4,1)) : Calculates the fraction Value of the year within the dates mentioned. Returns 0.25 as a result.
=YEARFRAC(DATE(2014,1,1),DATE(2015,4,1)) : Calculates the fraction Value of the year within the dates mentioned. Returns 1.25 as a result.

See Also

References