You need to sign in to do that
Don't have an account?

Formula to calculate value based on many number fields.
Hi all,
I'm looking for a help with creating formula field based on four number fields (Qty1_c, Qty2_c, Qty3_c, Qty4_c) :
If Qty1_c > 0
and Qty2_c = no value
return ashould be = Qty1_c
if Qty2_c > 0
and Qty3_c = no value
return shoudl be = Qty2_c
if Qty3_c > 0
and Qty4_c = no value
return shoudl be = Qty3_c
if Qty3_c > 0
and Qty4_c > 0
return shoudl be = Qty4_c
Thanks for help.
I'm looking for a help with creating formula field based on four number fields (Qty1_c, Qty2_c, Qty3_c, Qty4_c) :
If Qty1_c > 0
and Qty2_c = no value
return ashould be = Qty1_c
if Qty2_c > 0
and Qty3_c = no value
return shoudl be = Qty2_c
if Qty3_c > 0
and Qty4_c = no value
return shoudl be = Qty3_c
if Qty3_c > 0
and Qty4_c > 0
return shoudl be = Qty4_c
Thanks for help.
i can understand the issue , see in the formula we are checking for null and here in the qty2 u are entering 0 that's why this issue happen .
To resolve this issue you can put condition like this.
IF((Qty_1__c > 0 && (Qty_2__c =null || Qty_2__c=0 )), Qty_1__c, IF((Qty_2__c > 0 && (Qty_3__c =null|| Qty_3__c=0 )), Qty_2__c ,IF( (Qty_3__c > 0 && (Qty_4__c =null || Qty_4__c =0 ), Qty_3__c ,IF((Qty_3__c > 0 && Qty_4__c > 0), Qty_4__c ,null) ) ))
please let me know if this will help,
Thanks,
Keyur Modi
All Answers
I think your ReturnType of the Fromula field is number that's why it is giving that error inplace of false put null or 0(zero).
just like below code.
IF((Qty_1__c > 0 && Qty_2__c =null), Qty_1__c, IF((Qty_2__c > 0 && Qty_3__c =null), Qty_2__c ,IF( (Qty_3__c > 0 && Qty_4__c =null), Qty_3__c ,IF((Qty_3__c > 0 && Qty_4__c > 0), Qty_4__c ,null) ) ))
Thanks,
Keyur Modi
i can understand the issue , see in the formula we are checking for null and here in the qty2 u are entering 0 that's why this issue happen .
To resolve this issue you can put condition like this.
IF((Qty_1__c > 0 && (Qty_2__c =null || Qty_2__c=0 )), Qty_1__c, IF((Qty_2__c > 0 && (Qty_3__c =null|| Qty_3__c=0 )), Qty_2__c ,IF( (Qty_3__c > 0 && (Qty_4__c =null || Qty_4__c =0 ), Qty_3__c ,IF((Qty_3__c > 0 && Qty_4__c > 0), Qty_4__c ,null) ) ))
please let me know if this will help,
Thanks,
Keyur Modi