IIF Error: invalid syntax, may have entered a comma w/o preceding

T

TheDanimalMN

If anyone could provide assistance, I'd greatly appreciate it!

I have the following statement in Excel that I'm looking to replicate in an
Access report build:

=IF(AND(AB18<>"CALL",AB18<>"PUT"),0,IF(AND(P18-Z18>0,AB18="CALL"),(P18-Z18)*X18,IF(AND(Z18-P18>0,AB18="PUT"),(Z18-P18)*X18,0)))

I tried using the following formula but received an error: "The expression
you entered contains invalid syntax. You may have entered a comma without a
preceding value or identifier."

= IIF( And ([Derivatives!Call/Put ] <> "CALL", [Derivatives!Call/Put] <>
"PUT"),0,IIF( And ( [dbo_ASSET!EOM_Prc] - [Options!Strike Price] > 0,
[Derivatives!Call/Put] = "CALL"),( [dbo_ASSET!EOM_Prc] - [Options!Strike
Price] )* [Options!Shares Under Contract] ,IIF( And ( [Options!Strike Price]
- [dbo_ASSET!EOM_Prc] > 0, [Derivatives!Call/Put] ="PUT"),( [Options!Strike
Price] - [dbo_ASSET!EOM_Prc] )* [Options!Shares Under Contract] )))

I'm basically trying to build a report that will show the amount "In the
Money" or "Out of the Money" a contract. I'll look forward to any help!
 
J

John Spencer MVP

--Square brackets around the table name and the field name separately.
--Use AND operator between arguments in the comparison statement

IIF([Derivatives]![Call/Put]<>"CALL" AND Derivatives![Call/Put]<>"PUT",0

, IIF([dbo_ASSET]![EOM_Prc]- Options![Strike Price]>0
AND [Derivatives]![Call/Put]="CALL"
,([dbo_ASSET]![EOM_Prc]-[Options]![Strike Price])*
[Options!Shares Under Contract]

, IIF([Options]![Strike Price]-[dbo_ASSET]![EOM_Prc]>0
AND [Derivatives]![Call/Put] ="PUT"
,([Options]![Strike Price]-[dbo_ASSET]![EOM_Prc])
* [Options]![Shares Under Contract])))


John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top