Results 1 to 4 of 4
  1. #1
    twisted is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2012
    Posts
    9

    Need help with IIF

    Hey All,




    I have a IIF statement that keeps returning errors. Can I please get someone to point me in the right direction.
    I have a excel IF statement I need to pretty much copy in to access query

    Excel
    =IFERROR(IF(P30>(-15.55*LN(O30)+75.57),1,IF(P30>(-8.14*LN(O30)+39.991),2,IF(P30>(-5.061*LN(O30)+20.856),3,IF(P30>(-2.749*LN(O30)+10.05),4,5)))),"")
    P30 is Support
    O30 is Stability
    Access
    Probability: IIf([Support]>(-15.55*Log([Stability])+75.55,"1",IIf([Support]>(-8.14*Log([Stability])+39.991,"2",IIf([Support]>(-5.061*Log([Stability])+20.856,"3"))))))

    Thank you

  2. #2
    Rod is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Jun 2011
    Location
    Metro Manila, Philippines
    Posts
    679
    IIf([Support]>(-15.55*Log([Stability])+75.55,"1",IIf([Support]>(-8.14*Log([Stability])+39.991,"2",IIf([Support]>(-5.061*Log([Stability])+20.856,"3"))))))

    According to Help the Iif function takes three arguments - none of which is optional. You have a nested Iif function. Certainly the last Iif has only two arguments (red highlight). I suggest you examine the remainder of the expression.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Appears to be unnecessary parens. Try removing the parens highlighted in red. Also need value if last expression false. Why numbers in quote marks?

    Probability: IIf([Support]>(-15.55*Log([Stability])+75.55,"1",IIf([Support]>(-8.14*Log([Stability])+39.991,"2",IIf([Support]>(-5.061*Log([Stability])+20.856,"3",0))))))

    Provide some sample data for Stability.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    twisted is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2012
    Posts
    9
    Quote Originally Posted by June7 View Post
    Appears to be unnecessary parens. Try removing the parens highlighted in red. Also need value if last expression false. Why numbers in quote marks?

    Probability: IIf([Support]>(-15.55*Log([Stability])+75.55,"1",IIf([Support]>(-8.14*Log([Stability])+39.991,"2",IIf([Support]>(-5.061*Log([Stability])+20.856,"3",0))))))

    Provide some sample data for Stability.
    Thank you June7 you pointed out my error. I have a working formula now.

Please reply to this thread with any new information or opinions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums