Hi, I am trying to create a make-table query that includes an expression which will average four fields.
My problem is that the fields contain null values for certain rows.
I want the expression to take the average of the non-null values (including zeros) within the four fields and disregard the nulls.
Here's a table describing what I want my outcome table to show:
Here is the expression I am trying to use but something is messing it up.
Could someone help me write the appropriate expression?
Also, I would like my expression to return values with decimals to the tenths place.
Thank you! Gerry
My problem is that the fields contain null values for certain rows.
I want the expression to take the average of the non-null values (including zeros) within the four fields and disregard the nulls.
Here's a table describing what I want my outcome table to show:
Code:
ID Field1 Field2 Field3 Field4 Average 1 19 2 5 8.67 2 3 2 1 2 3 1 1 1 0 0.75
Code:
Average:([Field1]+[Field2]+[Field3]+[Field4])/(4-iif(isnull([Field1]),1,0)-iif(isnull([Field2]),1,0)-iif(isnull([Field3]),1,0)-iif(isnull([Field4]),1,0))
Also, I would like my expression to return values with decimals to the tenths place.
Thank you! Gerry
Comment