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
Chris Allen 34Chris Allen 34 

Formula field with Showing Flags ( Good, AT Risk, and Okay )

Good Morning,

I am trying to create a formula field "Total Health Score" where If the score is 1 - 4.75 = Good, 5 - 6.75 = okay and 7-10 = At Risk with colored Flags Red, Green and Yellow. I created the picklist field called "Total Customer Health Score" with At Risk, Good, and Okay. I am having trouble with if it is zero, then a green flag show. How would I either show a different flag or something else or not show anything if it is zero. Here is my formula I have now:

IF(
Total_Customer_Health_Score__c  <= 4.75 ,
IMAGE('/img/samples/flag_green.gif','Green Flag'),
IF(
Total_Customer_Health_Score__c  <= 6.75,
IMAGE('/img/samples/flag_yellow.gif','Yellow Flag'),
IF(
Total_Customer_Health_Score__c   >= 7,
IMAGE('/img/samples/flag_red.gif', 'Red Flag'),
IF(
Total_Customer_Health_Score__c = 0,
NULL, NULL))))
Best Answer chosen by Chris Allen 34
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Chris,

Can you try the formula as below.
 
IF(
AND(Total_Customer_Health_Score__c  <= 4.75 , Total_Customer_Health_Score__c !=0),
IMAGE('/img/samples/flag_green.gif','Green Flag'),
IF(
AND(Total_Customer_Health_Score__c  <= 6.75,Total_Customer_Health_Score__c >4.75) ,
IMAGE('/img/samples/flag_yellow.gif','Yellow Flag'),
IF(
Total_Customer_Health_Score__c   >= 7,
IMAGE('/img/samples/flag_red.gif', 'Red Flag'),
 NULL)))

Let me know if you face any syntax issues .

If this solution helps, Please mark it as best answer.

Thanks,

All Answers

Sai PraveenSai Praveen (Salesforce Developers) 
Hi Chris,

Can you try the formula as below.
 
IF(
AND(Total_Customer_Health_Score__c  <= 4.75 , Total_Customer_Health_Score__c !=0),
IMAGE('/img/samples/flag_green.gif','Green Flag'),
IF(
AND(Total_Customer_Health_Score__c  <= 6.75,Total_Customer_Health_Score__c >4.75) ,
IMAGE('/img/samples/flag_yellow.gif','Yellow Flag'),
IF(
Total_Customer_Health_Score__c   >= 7,
IMAGE('/img/samples/flag_red.gif', 'Red Flag'),
 NULL)))

Let me know if you face any syntax issues .

If this solution helps, Please mark it as best answer.

Thanks,
This was selected as the best answer
Vladyslav LazurchenkoVladyslav Lazurchenko
Thanks for your answer, it helped me too.

Vladyslav Lazurchenko. Find me at https://500px.com/p/lazzzko
jilotay yennijilotay yenni
Thanks for your answer I came here to look for something different .
Here we will provide you with interesting content Mambo Seafood Menu (https://seafood-menu.com/mambo-seafood-menu" target="_blank
Maverick BlazeMaverick Blaze
I noticed that you're working with a formula in Salesforce. The formula you provided seems to assign different flag images based on the Total_Customer_Health_Score__c value. It's great that you're using conditional logic to achieve this.
To make it even more efficient, you could simplify the formula using nested IF statements. Here's an alternative approach:
IF(Total_Customer_Health_Score__c <= 4.75 && Total_Customer_Health_Score__c != 0, IMAGE('/img/samples/flag_green.gif','Green Flag'), IF(Total_Customer_Health_Score__c <= 6.75 && Total_Customer_Health_Score__c > 4.75, IMAGE('/img/samples/flag_yellow.gif','Yellow Flag'), IF(Total_Customer_Health_Score__c >= 7, IMAGE('/img/samples/flag_red.gif','Red Flag'), NULL)))
This condensed version achieves the same outcome. However, please note that the formula you provided appears to be syntactically correct. If you encounter any issues while implementing it, feel free to reach out for further assistance.
Remember, if this solution proves helpful, don't forget to mark it as the best answer.
Best regards,
https://apkwa.net/