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

Multiple IIf statements

P: 13
Hello everyone. I'm trying to create a formula that will return values based on several fields. I have 2 dates - Depot In and Depot Out. The formula requires more than 2 calculations and this is where get confused whether it is possible to use a IIf statement.

The formula is used to calculate the storage fees of containers

The logic behind the formula is - If [Depot Out] IsNotNull then datediff("d",[Depot In],[Depot Out])*[Storage Fee] ... now here's the trouble: the statement divides into 2 more ifs - if [Depot Out] IsNull and datediff("d",[Depot In],Date())<31 then datediff("d",[Depot In],Date())*[Storage Fee] otherwise 31*[Storage Fee]

Any ideas?

Best regards,Eugene
Aug 3 '08 #1
Share this Question
Share on Google+
2 Replies


P: 13
Expand|Select|Wrap|Line Numbers
  1. DepotFee: IIf(Not IsNull([Depot Out Date]),
  2. DatePart("d",[Depot In Date])*[Storage Fee/Day],
  3. IIf(DateDiff("d",[Depot In Date],
  4. Date())<31,DateDiff("d",[Depot Out Date],Date())*[Storage Fee/Day],
  5. 31*[Storage Fee/Day]))
Solved i guess ;) thanks
Aug 3 '08 #2

NeoPa
Expert Mod 15k+
P: 31,186
Thanks for posting the solution Eugene.

Welcome to Bytes!
Aug 10 '08 #3

Post your reply

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