Microsoft Excel: mac 2008 (mac)

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

Hi, 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:=IF(DATEDIF(A26,B26,"y")>0,"LONG","SHORT")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()Regards

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.

Ask Your Question

Weekly Poll