By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,453 Members | 3,183 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,453 IT Pros & Developers. It's quick & easy.

Multiple if statement

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

thank u in advance
Jul 25 '12 #1
Share this Question
Share on Google+
2 Replies


Seth Schrock
Expert 2.5K+
P: 2,941
Is this is a SQL query or in VBA?

Let me see if I have your current formula correct.
Expand|Select|Wrap|Line Numbers
  1. IIF(Date < #1/3/2012#
  2. , [Amount for vat] = *0.15
  3. , [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?
Jul 25 '12 #2

twinnyfo
Expert Mod 2.5K+
P: 3,284
This might solve for the SalesType = 2:

Expand|Select|Wrap|Line Numbers
  1. IIF([salestype] = 2,
  2.     [vat] = 0,
  3.     IIF(Date < #1/3/2012#,
  4.         [Amount for vat] = *0.15,
  5.         [Amount for vat] = *0.17))
  6.  
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.
Jul 25 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.