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
Alfredo SilverioAlfredo Silverio 

Avoid Divided by 0

I try not divided by 0 

I have variable with the Yearky Results this is the code
IF((AND(ISBLANK(Q1_c__c),ISBLANK(Q2_c__c),ISBLANK(Q3_c__c),ISBLANK(Q4_c__c))), 0,

IF((Q1_c__c + Q2_c__c + Q3_c__c + Q4_c__c) = Goal_Number__c,Goal_Number__c,

(((Q1_c__c + Q2_c__c + Q3_c__c + Q4_c__c)/Goal_Number__c)/4)))

With 4 Quarents with results 
 
Variable = Q1_c__c
IF(OR(ISBLANK(Q1_Value__c),ISBLANK(Q1_Goal__c)),0,Q1_Value__c / Q1_Goal__c) 

By in this quarter variables in one year you can use one quarter only or two or 3 or used all. And add to this you go over of 5,000 caracters in each formula. How can i do this 
Best Answer chosen by Alfredo Silverio
Abdul KhatriAbdul Khatri
Hi Alfredo,

Please try this

I added a OR Check to see if all the values are 0s
 
IF(
	OR(AND(ISBLANK(Q1_c__c),ISBLANK(Q2_c__c),ISBLANK(Q3_c__c),ISBLANK(Q4_c__c)), AND(Q1_c__c=0,Q2_c__c=0,Q3_c__c=0,Q4_c__c=0)), 0,
		IF(
			(Q1_c__c + Q2_c__c + Q3_c__c + Q4_c__c) = Goal_Number__c, Goal_Number__c,
				(((Q1_c__c + Q2_c__c + Q3_c__c + Q4_c__c)/Goal_Number__c)/4)
		)
)

 

All Answers

Abdul KhatriAbdul Khatri
Hi Alfredo,

Please try this

I added a OR Check to see if all the values are 0s
 
IF(
	OR(AND(ISBLANK(Q1_c__c),ISBLANK(Q2_c__c),ISBLANK(Q3_c__c),ISBLANK(Q4_c__c)), AND(Q1_c__c=0,Q2_c__c=0,Q3_c__c=0,Q4_c__c=0)), 0,
		IF(
			(Q1_c__c + Q2_c__c + Q3_c__c + Q4_c__c) = Goal_Number__c, Goal_Number__c,
				(((Q1_c__c + Q2_c__c + Q3_c__c + Q4_c__c)/Goal_Number__c)/4)
		)
)

 
This was selected as the best answer
Abdul KhatriAbdul Khatri
Hey Alfredo,

Did it work?
Suraj Tripathi 47Suraj Tripathi 47
Hi Alfredo ,

I guess if you put your condition then that time the OR condition value should be zero(0s).
and the above code will help you to understand in better way.

 
 If you find your Solution then mark this as the best answer.

 

  Thank you!


  Regards,
  Suraj Tripathi 
Alfredo SilverioAlfredo Silverio
Sorry guys for my late responds.

Works good with that change. Thanks for the help