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
kaulsaksoftkaulsaksoft 

Loops in Formulae Field

Hi

 

how to do "FOR" loop kind of functions in Formula Fields?

 

I need to execute the For  

 

 Sum from Y= 1 to Y=80 of {  (1+400/100)**RATE}

 

Has anyone done the same in Salesforce without Apex Code

mpannmpann

You can not use LOOPS in formulas. You could use s-controls, though.

 

To calculate the sum of all integers between 1 and n you can use the mathemetical formula: n(n+1)/2.

 

If this is your theorethical FOR LOOP:

 

Y = 80

result =0
FOR (rate = 1 to Y) {
result = result + (1+400/100)*rate)
}

 (1+400/100) = 5, btw.

 

Then the formula

 

(Y(Y+1)/2)*5 will give you your result.

 

Is that what you were looking for?

 

Message Edited by mpann on 08-21-2009 10:11 AM