function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ariana VegaAriana Vega 

Checkbox formula using IF and OR statements

Hi all!
Today I am wondering if anyone can help me with something quite simple.  I am trying to create a formula checkbox field in my contact object that relates to fields in the same contact object.

This formula field should be checked off IF contacts have completed 1 computer training or if they've completed both.

I started off with a formula similar to this,

IF(
AND (
 Digital_Lit_101__c, 1,
 Digital_Lit_201__c, 1,
0) = 0,

but get stuck at this stage. I also tried this formula,

IF( Digital_Lit_101__c , 1, 0,
  IF(  Digital_Lit_201__c  , 1, 0, "")
)

But get this error message,  Error: Incorrect number of parameters for function 'IF()'. Expected 3, received 4.

If anyone can provide assistance it would be greatly appreciated!
Thank you!
 
Best Answer chosen by Ariana Vega
Saravana Muthu 8Saravana Muthu 8
Hi,

Please use the below formula in case if you want both the checkbox checked.

AND(Digital_Lit_101__c,Digital_Lit_201__c)


Please let me know if it helps.


Please don't forget to mark this as solved if it's resolved.

Thanks,
Saravana

All Answers

Saravana Muthu 8Saravana Muthu 8
Hi,

Can you please let me know what is the data type of the field name Digital_Lit_101__c,Digital_Lit_201__c?

Thanks,
Saravana
Ariana VegaAriana Vega
Hi Saravana! Thanks for the response, they are both checkboxes. 
Manjul SharmaManjul Sharma
Hi Ariana, you might want to try this if you want the formula to evaluate to false in case any of the 2 trainings are done:

NOT( OR( Digital_Lit_101__c,
 Digital_Lit_201__c ) )
Saravana Muthu 8Saravana Muthu 8
Hi,

Please use the below formula in case if you want both the checkbox checked.

AND(Digital_Lit_101__c,Digital_Lit_201__c)


Please let me know if it helps.


Please don't forget to mark this as solved if it's resolved.

Thanks,
Saravana
This was selected as the best answer
Ariana VegaAriana Vega
Thanks so much!!!

It seems as if the 

NOT( OR( Digital_Lit_101__c,
 Digital_Lit_201__c ) ) 

Is not working for the purpose needed. I need it to be checked off if they have either training checked off. So if they've only completed one or both it should be checked off and if they have none checked it should also be unchecked. However, I figured it out-- and it was just as simple as I thought. In the end, this was all I needed, 

OR (Digital_Lit_101__c,Digital_Lit_201__c)

Thank you for the responses!!