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
communitycommunity 

Formula Field - with Nested IF Conditions

I have 4 fields - Category1, Category2, Category3, Category4

 

I have created a formula field which concatenates all these into 1 single field and shows in the new field called TotalCategories

 

Total Categories = "Category1:" & Category_1__c & ";Category2:" & Category_2__c & ";Category3:" & Category_3__c & ";Category4" & Category_4__c

 

This is absolutely fine. But when only Category1 is filled.. Total Categories should show only Category1:"Category_1__c". Can anyone help .. how to do ? I tried using 'Case' but no use.

Best Answer chosen by Admin (Salesforce Developers) 
Pradeep_NavatarPradeep_Navatar

Change the formula to the following :

 

(IF(ISBLANK(Category_1__c), " ", "Category1:" & Category_1__c) + IF(ISBLANK(Category_2__c), " ", "Category2:" & Category_2__c)+ IF(ISBLANK(Category_3__c), " ", "Category3:" & Category_3__c)+ IF(ISBLANK(Category_4__c), " ", "Category4:" & Category_4__c))

 

Did this answer your question? if so, please mark it solved.

All Answers

Pradeep_NavatarPradeep_Navatar

Change the formula to the following :

 

(IF(ISBLANK(Category_1__c), " ", "Category1:" & Category_1__c) + IF(ISBLANK(Category_2__c), " ", "Category2:" & Category_2__c)+ IF(ISBLANK(Category_3__c), " ", "Category3:" & Category_3__c)+ IF(ISBLANK(Category_4__c), " ", "Category4:" & Category_4__c))

 

Did this answer your question? if so, please mark it solved.

This was selected as the best answer
communitycommunity

Thanks for the reply. Great. It works. Actually I have one more set to it.

 

For each category there is one more field : Amount1, Amount2...Amount4

 

What i want to get is...  say if 3 and 4 are empty... then it should display

 

TotalCategories = category1: XXXX; Amount1: XXXX; category2: XXXX; Amount2:XXXX.

 

 

if only 4 is empty..

 

TotalCategories = category1: XXXX; Amount1: XXXX; category2: XXXX; Amount2:XXXX; category3: XXXX; Amount3: XXXX;

 

 

Any idea ?

communitycommunity

My bad... its the same.. got it.. Thanks !

CG1000CG1000
Can someone correct me if I am wrong. It seems that the concatenating would be stopped dead in it's tracks if "Category 1" was blank. The formula ends at the first blank field.

Is there a way to sweep through multiple fields and create a single concatenated field based on the data it finds? In other words create a single field that tells a story.

I have a complex formula that displays a warning image when at least one of many criteria (spanning 10 different fields) is met. Now I need a single field to state which fields have caused the warning image to appear.
CG1000CG1000
Ahhh I stand corrected- it is all in the placement of the parenthesis!!
developer org 183developer org 183
Create formula field 'Total amount' IF(amount = null, anuual amount, Normalamount)
 Note 1: Please take Normalamount when the field is NOT empty, in other case please take .annual amount
Note 2: If the real value of 'Total Amonut, the value shown in the field is 0.

I am phasing issue

Please any one can help me