IF/Then Help, almost complete!

Bremen217

Registered User.
Local time
Today, 14:01
Joined
Nov 24, 2010
Messages
19
Hey Gang!

I just need a little help cleaning this up I know it isn't hard but I since I am not an SQL expert I know enough to realize I am missing something. Lets say I have 2 values (ValueA and ValueB) both numerical. If both values are not null then I want the query to give me the sum of (ValueA *.4) and (ValueB *.6)....So no problems there I got that. Here's where I lose it a little. If ValueA is null then I want ValueB in its entirety displayed and vice versa, if ValueB is null give me ValueA in its entirety. So I know I can do this with 2 If then statements, but can I do it with one?

Here's what I have now:

Iif([ValueA]=null,[ValueB],(([ValueA]*.60)+([ValueB]*.4)))

and a second if/then where ValueA and ValueB are reveresed. How can I do this in one statement?
Thanks!
 
Last edited:
Iif(IsNull([ValueA]),[ValueB],IIF(IsNull([ValueB],[ValueA],([ValueA]*.60)+([ValueB]*.4)))
 
Perfect! Thank you very much! I wasn't quite sure how this got nested. Thanks Bob!
 

Users who are viewing this thread

Back
Top Bottom