IF Statements for Time

Microsoft Excel: mac 2008 (mac)
February 3, 2010 at 20:46:30
Specs: Macintosh
In advance for your help. I am just trying to see if
there is a way create an IF STATEMENT to tell me
whether the difference between dates is either less
than a year "short" or more than a year "long".

I am preparing my taxes, but I have long list of stock
trades. I need to figure out which one are short and
which one are long.

Hopefully I could get something like this.

Date Acquired Date Sold
01/01/2009 06/30/2009 SHORT
01/01/2005 05/31/2009 LONG

See More: IF Statements for Time

February 4, 2010 at 04:51:25

You can do this with the DATEDIF() function. This is what I got:

01-Feb-09	04-Feb-10	LONG
09-Feb-09	04-Feb-10	SHORT

using this formula:
where A26 contained purchase/start date and B26 contained sold/end date.

DATEDIF() with "y" returns the completed number of years between dates. If less than a full year it returns zero.
The IF function returns the Long/Short text based on the value from DATEDIF()

PS Not sure about more recent versions of Excel, but this function does not appear in help files for Excel 2003, but it still works.

Report •
Related Solutions

Ask Question