How to i use an if statement in a calculated field?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • annakalli
    New Member
    • May 2010
    • 34

    How to i use an if statement in a calculated field?

    Hi, I have a calculated field in my query named VAT:, this field was the multiplication of the field
    Code:
    AMOUNT*0.15
    , but now the vat percentage is changed from the first of march to 0.17 instead of 0.15 so i want to use an if statement to check my transaction date in my query, if the date is before the 1/3/2012 the calculation to use the 0.15 otherwise to use the 0.17 .
  • Mariostg
    Contributor
    • Sep 2010
    • 332

    #2
    You can use iif() function.
    iif(mydate<#1/3/2012#,AMOUNT*0. 15,AMOUNT*0.17)

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32662

      #3
      Indeed, or even :
      Code:
      =[AMOUNT]*IIf([TranDate]<#1/3/2012#,0.15,0.17)

      Comment

      • Mariostg
        Contributor
        • Sep 2010
        • 332

        #4
        @NeoPa.
        Ok, yours is cleaner and easier to manage. :)

        Comment

        Working...