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
Ronty AhmadRonty Ahmad 

Can anyone Please help me to simplify this two formula.

/*
End Date of subscrition  and total membership fee Calculation :

Term__c is picklist and values are 12,24,36,48
Start_Date__c  is Start Date of  subscrition .
Rate__c  is number field for per month fee

I want have two Formula field should work like
End_date      = Start_Date__c + Term__c
Total_Amount = Rate__c * Term__c
*/

/*Formula for End Date formula(Date) Field is : */

IF(ISPICKVAL(Term__c, "12"), ADDMONTHS(Start_Date__c,12),
  IF(ISPICKVAL(Term__c, "24"), ADDMONTHS(Start_Date__c,24),
      IF(ISPICKVAL(Term__c, "36"), ADDMONTHS(Start_Date__c,36),
           IF(ISPICKVAL(Term__c, "48"), ADDMONTHS(Start_Date__c,48),null))))
           
/*Formula for Total Amount formula(currency) Field is : */

CASE(TEXT(Term__c),
         "12", (12* Rate__c) ,
          "24", (24* Rate__c) ,
          "36", (36* Rate__c) ,
          "48", (48* Rate__c) ,
0)

What is test away to rewrite this two formula function that is more dynamic . like i dont' need to set 12,36 ... in my formula.

 
VamsiVamsi
Hi,

You can make use of Value function to convert Text to Number in formulas as below.

VALUE(Text(myPicklist__c))

Hope this helps...!!