# YEARFRAC Function

> Calculate the fraction of a year between two dates with YEARFRAC in TX Sheet Control: the five day count bases, negative results, #NUM! errors and an example.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Function
- **Path:** TX Sheet Control > API Reference > Formula Functions > YEARFRAC Function
- **235 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/formula-functions/yearfrac/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/formula-functions/yearfrac/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/formula-functions/yearfrac/llms-full.txt

---

Return the fraction of a year between two dates. `start_date` and `end_date` are the dates, and `basis_or_method` selects the day count convention: 0 (US 30/360, the default), 1 (actual/actual), 2 (actual/360), 3 (actual/365) or 4 (European 30/360). Another basis returns `#NUM!`. When `end_date` is before `start_date`, TX Sheet Control returns a negative fraction.

### Syntax

```text
YEARFRAC(start_date, end_date, basis_or_method)
```

Category: Date & Time. Minimum arguments: 2. Maximum arguments: 3.

Available for supported offline calculation.

### Examples

```text
=YEARFRAC(DATE(2026,1,1),DATE(2027,1,1),3)
```

The formula returns 1, the full year from January 1, 2026, to January 1, 2027, on the actual/365 basis.

Cell and range examples require appropriate input values in the referenced cells. Handle invalid arguments, formula errors and array and spill constraints.

### See Also

- [Formulas](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/formulas/llms-full.txt)
- [Custom Functions and Formula Data](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/custom-functions/llms-full.txt)

---

## Nearby

- **Previous:** [YEAR Function](https://docs.textcontrol.com/tx-sheet-control/reference/formula-functions/year/llms-full.txt)
- **Next:** [YIELD Function](https://docs.textcontrol.com/tx-sheet-control/reference/formula-functions/yield/llms-full.txt)
