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
Felix QuinonesFelix Quinones 

IF There is a value, then due a division. If not, then null.

Hello All, 

I'm trying to create a formula for a compliance field (variable). The field could have values or not. If the field has values (Not Blank), I need that the field make a division (Q1_Value__c / Q1_Goal__c). If there is no values, I need the fielf diplay "N/A" or stay blanck. 

Something like the following: 

IF (OR
(NOT(ISBLANK(Q1_Goal__c)),
Q1_Value__c / Q1_Goal__c),
ISBLANK(Q1_Goal__c), "N/A"))

Thanks in advance. 

Best Answer chosen by Felix Quinones
PriyaPriya (Salesforce Developers) 

Hi Flexi,

Sorry I missed that closing bracket in expression. Try this below :- 

IF(NOT(ISBLANK(Q1_Goal__c)),(Q1_Value__c / Q1_Goal__c), “N/A”)


If this time solve your issue, please mark it as best answer.

If not let us know again, we will try our best to fix it.

Regards,

Priya Ranjan

All Answers

AbhinavAbhinav (Salesforce Developers) 
Try this

IF( AND( NOT(ISBLANK( Q1_Goal__c )) ,NOT(ISBLANK( Q1_Value__c ))) , Q1_Value__c/ Q1_Goal__c, null)


Thanks!
PriyaPriya (Salesforce Developers) 

Hi Felix,

 

IF(NOT(ISBLANK(Q1_Goal__c),(Q1_Value__c / Q1_Goal__c), “N/A”)
 

Please mark it as the Best Answer so that it can help others in the future.

Regards,

Priya Ranjan

 

Felix QuinonesFelix Quinones
Thanks Abhinav and Priya. 

Abhinav, your code work but I'm looking for something that returns "N/A". 
Priya, your code look great, but there is a error in the syntaxis. The formula indicate that there is a parenthesis missing. 

Thanks both for your help. 
Felix.
 
PriyaPriya (Salesforce Developers) 

Hi Flexi,

Sorry I missed that closing bracket in expression. Try this below :- 

IF(NOT(ISBLANK(Q1_Goal__c)),(Q1_Value__c / Q1_Goal__c), “N/A”)


If this time solve your issue, please mark it as best answer.

If not let us know again, we will try our best to fix it.

Regards,

Priya Ranjan

This was selected as the best answer