### Post

I am trying to score using calculation in FileMaker.

To get an item correct , a student must select both options 2 and 3 on the multiple-choice item. I wrote:

IF(ITEMR1=2 AND ITEMR1=3;1;0)

I cannot make this function work. It returns zero. Can someone show me a correct calculation?

Thanks.

If this were algebra you might more easily spot your mistake:

x = 2 and x = 3

will never be a true statement.

In the case of your database ITEMR1 contains both the response 2 and the response 3 so a different expression is needed to correctly determine that the answer is correct. Preumably, you are using a checkbox group format on the ITEMR1 field. If a user clicks the check boxes for the values 2 and 3, they will both be stored in the field, separated by a return character.

It might be 2<Return>3 or 3<Return>2, the order will reflect which check box was clicked first.

You could use:

IF ( ITEMR1 = List ( 2 ; 3 ) or ITEMR1 = List ( 3 ; 2 ) ; 1 ; 0 )

but there's a function, filterValues, that makes working with lists of values easier:

IF ( valueCount ( Filtervalues ( ITEMR1 ; List ( 2 ; 3 ) ) ) = 2 ; 1 ; 0 )

you can further simplify this expression to be:

valueCount ( Filtervalues ( ITEMR1 ; List ( 2 ; 3 ) ) ) = 2

Expressions that produce a value of True return the number 1. Those that produce False return the value 0.