 ShowAll Questionssorted byDate Posted Felix Quinones

# My formulas are not responding to blank fields.

Hello All,
I need to fix the following formulas on Salesforce. The current formulas work, but they are marking an error when the fields are empty. All the formulas are created as "treat blank fields as blanks". In this specific object on my system, blanck field means that do not apply.

First Formula:
This formula calculate a percent between 4 fields. It give me a yearl result.
IF(
AND
(Q1_c__c =0,
Q2_c__c = 0,
Q3_c__c = 0,
Q4_c__c = 0
),
0,
(Q1_c__c + Q2_c__c + Q3_c__c + Q4_c__c)/4)

The problem with the formula is that does not work if the Q1_c__c, Q2_c__c, Q3_c__c, or Q4_c__c,are blanks. If those fields are blank, the formula do not calculate the percentage.

Second Formula
This formula automatically add flags according to the value of certain fields.

(
IF( ISBLANK(Q1_Goal__c ) && ISBLANK(Q1_Value__c ),
IMAGE("https://i.ibb.co/PzwzmbZ/blue-flag.png", " Blue Flag"),

IF(NOT(ISBLANK(Q1_Goal__c )) && ISBLANK(Q1_Value__c ) ,
IMAGE("https://i.ibb.co/02GzKqM/red-flag.png", " Red Flag"),

IF(ISBLANK(Q1_c__c ),
IMAGE("https://i.ibb.co/PzwzmbZ/blue-flag.png", " Blue Flag"),

IF (Q1_c__c <= 0.80,
IMAGE("https://i.ibb.co/02GzKqM/red-flag.png", " Red Flag"),

IF (Q1_c__c <= 0.90,
IMAGE("https://i.ibb.co/59L8GnF/yellow-flag.png", " Yellow Flag"),
IMAGE("https://i.ibb.co/1KNswzk/green-flag.png", " Green Flag")))))))

The problem with the formula second formula  is that the second IF is not working.

IF(NOT(ISBLANK(Q1_Goal__c )) && ISBLANK(Q1_Value__c ) ,
IMAGE("https://i.ibb.co/02GzKqM/red-flag.png", " Red Flag"),

It suppsed that when Q1_Goal__c  is NOT blank (not empty) and Q1_Value__c is empty create a RED Flag. Currently is not doing that.

Any suggestions with the formulas.

Thank you,

Felix. CharuDutt
Hii Felix
Try Below Formula
```First Formula:
(f1__c + f2__c + f3__c + f4__c ) / 100

Second Formula:
IF(AND( ISBLANK(Q1_Goal__c ),ISBLANK(Q1_Value__c )),IMAGE("https://i.ibb.co/PzwzmbZ/blue-flag.png", " Blue Flag", 200, 250),
IF(AND(NOT(ISBLANK(Q1_Goal__c )),ISBLANK(Q1_Value__c )),IMAGE("https://i.ibb.co/02GzKqM/red-flag.png", " Red Flag", 200, 250),
IF(ISBLANK(Q1_c__c ),IMAGE("https://i.ibb.co/PzwzmbZ/blue-flag.png", " Blue Flag", 200, 250),
IF(Q1_c__c <= 0.80,IMAGE("https://i.ibb.co/02GzKqM/red-flag.png", " Red Flag", 200, 250),
IF(Q1_c__c <= 0.90,IMAGE("https://i.ibb.co/59L8GnF/yellow-flag.png", " Yellow Flag", 200, 250),IMAGE("https://i.ibb.co/1KNswzk/green-flag.png", " Green Flag", 200, 250))))))
```