I have not the foggiest idea what answer your calculation should return so I am not sure if this one works either, but here is how I would set it up:
If ( IsEmpty ( SellDate ) ; (Get ( CurrentDate ) - PurchaseDate) / 365 ; (SellDate - PurchaseDate) / 365 )
If not then a little more info and we'll try again. BTW the double slashes in a calculation are for commenting out the remainder of a line, ie, a way to leave notes to yourself. The calculation engine ignores that line.
I would assume the logic is this:
If there is a Sale Date, subtract Purchase Date from Sale Date. If no Sale Date, subtract Purchase Date from current date. Return results if only greater than (or equal to) a year. The problem with using 365 is that it will not always be accurate because of leap year. Even using 365.25 etc will still be off depending upon the span of years involved.
The truly safe way is to test for year difference and then see if the current date's month and day is before the Purchase Date's month and day and if so, subtract a year because it has not yet hit the anniversary. You might try this calculatioin (result is date) and be sure to set the calculation to 'unstored' in the Options or it won't update as the current date changes:
Let ( [
now = Get ( CurrentDate ) ;
sell = Case ( not Sale Date ; now ; Sale Date )
Year ( sell ) - Year ( Purchase Date ) - ( ( Month ( sell ) + Day ( sell ) / 100 ) < ( Month ( Purchase Date ) + Day ( Purchase Date ) / 100 ) )
Double front-slash means the current date when searching or on layouts (so I assume you meant to use it as the current date) but, as Bumper nicely points out, it means a comment when used within a calculation (but only to comment out the specific line it is on).
Anyway, let us know if we have misunderstood your need.