Results 1 to 5 of 5

Expression construction from Excel formula to Access

  1. #1
    Marcia is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Aug 2019
    Posts
    2

    Expression construction from Excel formula to Access

    Hi everyone. 95% of my working time I use Excel (never Access) but I was advised to shift to Access for a database. I copied the original excel file to Access but came up with problems on a formula. The excel formula is:
    =IF(SEX="","",IF(OR(SEX={"CHURCH","SCHOOL","GOVERN MENT"}),"EXEMPT",IF(AND([@[Classification of Property]]="Residential Building",[@[Assessed Value
    Imp.]]=0),"EXEMPT",IF(Year_1=2020,"CURRENT","DELINQUENT" ))))


    When I copied this to Access, it says AND and OR are invalid syntax. How do I edit this to make it valid? Thank you.

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,314
    See if this helps with both IIf() (not If) and And/Or within.

    https://www.techonthenet.com/access/...vanced/iif.php
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Marcia is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Aug 2019
    Posts
    2
    Thank you Paul. I finally got the desired results from the ff expression:
    Status: IIf([Sex]="SCHOOL" Or [Sex]="GOVERNMENT" Or [Sex]="CHURCH","EXEMPT",IIf([ClassificationOfProperty]="Residential Building" And [AssessedValueImp]=0,"EXEMPT",IIf([Year1]=2020,"CURRENT","DELINQUENT")))

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,314
    Happy to help and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Ajax is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    7,257
    An alternative way would be


    Status: IIf([Sex] IN ("SCHOOL","GOVERNMENT","CHURCH") OR ([ClassificationOfProperty]="Residential Building" And [AssessedValueImp]=0),"EXEMPT",IIf([Year_1]=2020,"CURRENT","DELINQUENT"))

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

Similar Threads

  1. Excel formula to access vba.
    By tonycl69 in forum Programming
    Replies: 2
    Last Post: 10-20-2016, 06:36 AM
  2. Replies: 19
    Last Post: 07-13-2015, 10:15 AM
  3. Replies: 3
    Last Post: 07-10-2015, 01:19 PM
  4. Replies: 41
    Last Post: 05-29-2015, 02:58 PM
  5. Using an Excel Formula in Access
    By BEI77 in forum Access
    Replies: 6
    Last Post: 05-08-2014, 05:08 PM

Posting Permissions

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