# Re: Complex Calculations

• From: John Machin <sjmachin lexicon net>
• To: gnumeric-list gnome org
• Subject: Re: Complex Calculations
• Date: Sat, 23 Feb 2008 11:44:48 +1100

```Norman Frederick wrote:
```
I am trying to create a spreadsheet to keep track of my wife's stock transactions. I want it to track the info we need to furnish the IRS on tax returns. Is there a way to create a formula or script that will run in a cell to: Read the dates in two cells.
```    Determine the number of days between the two dates.
```
Evaluate the number of days as greater or less than one year.
```
```
Given the existence of leap years, the above is is rather ambiguous. You need DATEDIF(earlierdate, laterdate, "y") which gives you the number of complete years between 2 dates, based on one definition of complete year. You may need to do some adjustment like DATEDIF(earlierdate, laterdate+1, "y") depending on what the IRS's definition is for your particular purpose i.e. depends on whether the start day and end day are included or not.
```
```
```        Subtract numerical data from two cells.
```
Place the result in a specific cell, based on the time being more or less than one year.
```
And if it's exactly one year?

```
```
I have found nothing so far that addresses this type operation.
```
```
```
In Gnumeric: Help / contents / function reference / Date/Time / ... DATEDIF is the 3rd function listed
```
```