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
Terry_0101Terry_0101 

Riddle: how to calculate and then display?

How to divide/multiply a number, and then display values based on the result?

Example:
number__c / 5 * 30

If the answer is below 100, then display "Disappointing"
If the above 101, then display "WOW"
 
Prem Anandh 1Prem Anandh 1
Hi Samantha, 

Please refer below code.
Integer result = number__c / 5 * 30; 

if(result <= 100)
system.debug('--- Disappointing ---');
else if(result >= 101)
system.debug('--- Wow ---');

Thanks, 
Prem Anandh


 
Parker EdelmannParker Edelmann
If you wish to use this in a formula, try one of these variations:
IF(Number__c < 100, "Disappointing", "WOW")
 
IF(Number__c < 100, "Disappointing", "") &
IF(Number__c => 100, "WOW", "")