AnsweredAssumed Answered

If formula problems

Question asked by jebber6685 on May 25, 2011
Latest reply on May 26, 2011 by LaRetta_1

Title

If formula problems

Post

I cannot seem to get an If formula to work. Any help would be greatly appreciated.

I created a stock transaction database. To do that, you need to know when you bought and sold the stock. I also want to create field that will return an number that represents the time in years that that stock has been held. I want this field to return the hold period even if the stock has not been sold and is still owned.  

To do this, I felt that an IF formula should do the trick, but I cannot seem to get it to work. Here is what I put together;

If(Sell Date = "";(// - Purchase Date)/365;Sell Date -Purchase Date)/365 )

The Sell Date is the date the stock is sold, but if the stock has not been sold yet this field will be empty. For this reason, I used the Sell Date field as the test in the IF formula.

Sell Date = "" This is the test that basically if Sell Date is empty, then....... Is the "" the right way to represent an empty field?

The "//" I believe is the return for the current date. So if there is nothing in the Sell Date field, then the value will be the current date - the Purchase Date.

But when I put this in FM, I get the return, "A number, text constant, field name or "(" is expected here."

What am I doing wrong? Any suggestions would be greatly appreciated. 

I have FMPro Advanced 11.0 v3OS - Windows Vista on desktop, Windows 7 on laptop

Outcomes