Multiple if statement

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

    #1

    Multiple if statement

    Hi, I have the 4 following fields, salestype,amoun t for vat,date and vat. The answers for the
    Code:
    salestype
    it can be either 1(with vat) or 2 (without vat), for the field
    Code:
    vat
    i use the formula =iff
    Code:
    date
    <1/3/2012;
    Code:
    amount for vat
    *0.15;
    Code:
    amount for vat
    *0.17). The problem is that when i calculate the field
    Code:
    vat
    i want to check the
    Code:
    salestype
    and if that has the value 2 i want the value for the field
    Code:
    vat
    to be zero otherwise to check the date. How can i add that extra if in my current formula

    thank u in advance
  • Seth Schrock
    Recognized Expert Specialist
    • Dec 2010
    • 2965

    #2
    Is this is a SQL query or in VBA?

    Let me see if I have your current formula correct.
    Code:
    IIF(Date < #1/3/2012#
    , [Amount for vat] = *0.15
    , [Amount for vat] = *0.17)
    And you want to only run that IIF statement when Salestype = 1. If Salestype = 1, then you want vat to be 0. Is this correct?

    Comment

    • twinnyfo
      Recognized Expert Moderator Specialist
      • Nov 2011
      • 3665

      #3
      This might solve for the SalesType = 2:

      Code:
      IIF([salestype] = 2,
          [vat] = 0,
          IIF(Date < #1/3/2012#,
              [Amount for vat] = *0.15,
              [Amount for vat] = *0.17))
      Is [vat] usually a calcuated amount based on the price of an item and then multiplied by the [Amount fo vat]? If that is the case, then [Amount for vat] could also be set to *0, which would calculate out to 0.

      Hope this helps.

      Comment

      Working...