+ Start a Discussion
Jordan Torrey 23Jordan Torrey 23 

In my "IF" statement, I want my "false" value to do nothing in my formula.

Just getting more practice with formulas but have run into an obstacle. Hopefully I'm overthinking it, but I'm writing a throw away formula:

IF( AnnualRevenue >= 1000000, NumberOfEmployees, " ???  ")

The goal is to throw an error message telling the user if the "AnnualRevenue" is greater than or equal to one million, then the "NumberOfEmployees" field is mandatory, else do nothing. What value do I need to enter in the "false" field? I've tried using "null" however there needs to be an actual value. Is using an "IF" statement the wrong route to take for this goal?

Any assistance is more than welcome. Thanks in adnvacned!!
Best Answer chosen by Jordan Torrey 23
KimKim
Hi Jordan,

Are you writing a formula field? If you write a Validation rule, all you need is the the formula below, and add the message you want in the Error Message section. If the record meets the criteria below, it should throw the error that they need to fill out the NumberofEmployees field.
AND(
AnnualRevenue >= '1000000',
ISBLANK(NumberOfEmployees)
)

 

All Answers

KimKim
Hi Jordan,

Are you writing a formula field? If you write a Validation rule, all you need is the the formula below, and add the message you want in the Error Message section. If the record meets the criteria below, it should throw the error that they need to fill out the NumberofEmployees field.
AND(
AnnualRevenue >= '1000000',
ISBLANK(NumberOfEmployees)
)

 
This was selected as the best answer
Jordan Torrey 23Jordan Torrey 23
Hi Kim,
Yes apologies; I missspoke. Thank you for providing this formula. One of my attempts was close to this but looked more like:

IF(ISBLANK(AnnualRevenue) >= 100000, NumberofEmployees, ???)

But for obvious reasons failed. Your formula worked like a charm. Thank you for your assistance Kim!
olaitan adesojiolaitan adesoji
hello @Kim, i also have a similar issue.. i used a formula on a visualforce page.. i want the formula to do NOTHING, like exactly Nothing if the value evaluates to false....heres my code...

 
<apex:repeat value="{! Comments}" var="Com">
<apex:outputText styleClass="textTag">  {! IF (Com.FeedIdentity__c ==Fd.Identity__c,Com.CommentBody__c, '-')}</apex:outputText>
</apex:repeat>
im trying to display custom comments for a feed object in my view... i only want the output text to display that comment body when the value evaluates to true....

also the code is iterating through  a list of custom Comment Objects.... please any help would be appreciated..thanks