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
ArmanMArmanM 

Custom field formula

Hi, 

I would like to create a custom field formula that has two conditions and based on that conditions it will perform a formula. 
*IF (field is empty/null) -> perform formula 1
otherwise (field is not empty/null) -> perform formula 2

Thanks !
 
Best Answer chosen by ArmanM
RaidanRaidan
In that case you can use a Workflow (Field Update) or Process Builder.

All Answers

RaidanRaidan
When you say perform a formula, are you referring to returning the value from a formula? To do so, make sure you have two formula fields that return the same data type. Say you have Text_Formula_1__c and Text_Formula_2__c (both returns text). Create a new formula field (same return data type), let's call it Text_Formula_3__c (return text). And the formula will look like this:
IF (ISBLANK(Field__c), Text_Formula_1__c, Text_Formula_2__c)

 
ArmanMArmanM
Okay let me try explaining myself a little more. Lets say I already have a currency field called Currency_c and a number field Numbers_c. I want to create a new custom formula field Rate_c which would perform (Currency_c *10) / Numbers_c if Rate_c is left emplt/blank. How would this be possible ?
RaidanRaidan
I am a bit confused about leaving the Rate__c field blank. Rate__c is a formula field, so it is read-only. However to check for blank/null, you can use ISBLANK() function.
ArmanMArmanM
No. I want to make Rate__c an actual field where the user can put a value in and if the user doesnt put something in then that formula will execute 
RaidanRaidan
In that case you can use a Workflow (Field Update) or Process Builder.
This was selected as the best answer
ArmanMArmanM
okay thanks, I'll try that out