sum iff

C

Clay

I am creating a form to score psychological assessments
and I am using the conditional IIF statement to return
values for an number of expressions. I would also like
to sum the result of each conditional so that I will have
a count of the number of true statments for the
conditional. Here is my conditional. Can someone tell me
how to get sum to work with it? =IIF([BRIC 1]>=1,"0","0")
+IIF([BRIC 2]>=1,"1","0")+IIF([BRIC 3]>=1,"1","0")+IIF
([BRIC 4]>=1,"1","0")
 
S

Scott N. Weber

try:

Sum(IIF([BRIC 1]>=1,"0","0")+IIF([BRIC 2]>=1,"1","0")+IIF([BRIC
3]>=1,"1","0")+IIF([BRIC 4]>=1,"1","0"))
 
M

Marshall Barton

Scott said:
try:

Sum(IIF([BRIC 1]>=1,"0","0")+IIF([BRIC 2]>=1,"1","0")+IIF([BRIC
3]>=1,"1","0")+IIF([BRIC 4]>=1,"1","0"))


Looks good (even if I don't understand why the first IIf has
both conditions return "0").

But you'll have to get rid of all those quotes (Sum only
adds numeric values).

Assuming I understand what's wanted here, that can be
shortened to:

=Abs(Sum(([BRIC 1]>=1)+([BRIC 2]>=1)+([BRIC 3]>=1)
+([BRIC 4]>=1)))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top