 ShowAll Questionssorted byDate Posted JCD@class

# IF statements and Checkboxes

Using the Formula field, is there a way to calculate how many check boxes are checked?

Here is an example. I have 3 check boxes: check1 (if this is checked, the value is 10), check2 (if this is checked, the value is 20), check3 (if this is checked, the value is 30) and a formula field: formula1.

In the formula field, I want to test how many of those 3 checkboxes are checked, and add the value for each checkbox.

So if check1 is checked, then formula1 = 10; if check2 is checked then formula1 = 20 and so on. But if check1 and check2 is selected, then formula1 = 30.

The only way I could think of is by creating a variable and adding to it for the value of formula1. Does anyone know another way using a combination of functions?

Thanks,
Daniel Best Answer chosen by Admin (Salesforce Developers)  Buell
Code:
```IF(Check1 = True, 10, 0) + IF(Check2 = True, 20, 0) + IF(Check3 = True, 30, 0)
```

Make sure it's a number formula field. Buell
Code:
```IF(Check1 = True, 10, 0) + IF(Check2 = True, 20, 0) + IF(Check3 = True, 30, 0)
```

Make sure it's a number formula field.
This was selected as the best answer Jakester
I think Buell's code will work just fine, but FYI, it's not necessary to add the "= True" if the field is a checkbox. So, it would be shorter to write If(Check1,10,), + ... Buell
Jakester, nice!  I like it.