# Using advanced IF in Formula field

I am trying to get the percentage of process completion. I have some checkboxes, and I want to check if each one is checked or not. For every checked box, I will increase some value and then get the percentage.

Checkboxes:

• isEmailed__c
• isSubmitted__c
• isCalled__c

Long Percentage field: Percentage__c

The logic:

``````Long count 0;
If(isEmailed__c)
count++;
If(isSybmitted__c)
count++;
If(isCalled__c)
count++;

percentage__c = (count/3)*100;
``````

How could I implement this logic using a formula field?

Try something like this

``````((IF(isEmailed = True, 1,0)
+
IF(isSubmitted = True, 1,0)
+
IF(isCalled = True, 1,0))
/3) * 100
``````

The if you add any more checkboxes that need to be worked in, you just need to add another

``````IF(Checkbox_Field__c = True, 1,0)
``````

and also increase the number you are dividing by

• Worked just well after removing (* 100), Thanks @chris-duncombe 👍. I will mark your answer as the right answer in a minute ;) Commented May 29, 2015 at 12:46
• Hmmmm. it shoudl work with the *100. without it, you just have a decimal. I mean the decimal is fine, just figured you would want a whole number between 0 and 100. Did it give an error? Commented May 29, 2015 at 12:47
• Maybe because I set the field type to "Percent", it's automatically multiplied to 100 @chris-duncombe Commented May 29, 2015 at 12:49
• Really only need `IF(Checkbox_Field__c, 1, 0)`. Checking if a boolean field is equal to True is redundant. Commented May 29, 2015 at 14:38
• @ScottW, I agree with you, that is true, but I generally only do that in Apex code. When using formula fields, often admins might be looking at and updating the formulas, so I try to make it as clear and readable as possible. Although using = true is redundant, it does make it more readable and much more clear to someone who might not be familiar with syntax. Commented May 29, 2015 at 14:40