Avatar of ajaeclarke
ajaeclarke asked on

Expression has the wrong amount of arguments

Hi

I am having some trouble with the below expression in a query. I am trying to get the average of three fields which allows for zero's.

ACWLW: ([RELTTMALW]+[AOLTTMALW]+[WTMALW])/IIf((-([RELTTMALW]<>0)-([AOLTTMALW]<>0)-([WTMALW]<>0))

It is telling me that The Expression you entered has a function containing the wrong number of arguments.

It has been a long day and I just cannot see it!! Could somebody please enlighten me :-)

Thanking you
Microsoft Access

Avatar of undefined
Last Comment
Gustav Brock

8/22/2022 - Mon
Daniel Pineault

IIF() expects 3 input variables, the criteria to test for, what to do if it is TRUE, what to do if it is FALSE.
If you explain what should be happening, we can try to further help.

Also, ypically I would use Nz([FiledName], 0)  to always ensure there is a numeric value being returned just in case a field is empty, Null which could cause errors to be thrown.
ASKER CERTIFIED SOLUTION
Gustav Brock

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
ajaeclarke

You are a legend Gustav! Thank you so much. :)
Gustav Brock

You are welcome!
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck