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
Robin Thomas 19Robin Thomas 19 

If a field contains a value then use this formula to determine the output

I keep receiving a "Missing ) Error"

IF(Acq_Comm_Calc__c CONTAINS $500),Estimated_Net_Profit_Retail_Renovation__c+500,
IF(AND Acq_Comm_Calc__c CONTAINS 8%),Estimated_Net_Profit_Retail_Renovation__c*0.08,
IF(AND Acq_Comm_Calc__c CONTAINS 10%),Estimated_Net_Profit_Retail_Renovation__c*0.1,
IF(AND Acq_Comm_Calc__c CONTAINS 12%),Estimated_Net_Profit_Retail_Renovation__c*0.12,
IF(AND Acq_Comm_Calc__c CONTAINS 15%),Estimated_Net_Profit_Retail_Renovation__c*0.15,
IF(Acq_Comm_Calc__c CONTAINS $7000),Estimated_Net_Profit_Retail_Renovation__c+7000,)
)
)
)
)

)
Best Answer chosen by Robin Thomas 19
Abdul KhatriAbdul Khatri
Even it doesn't add upto 15000 characters, something is not right.

Please correct your above formula with this, I think that may be causing the issue
IF(Estimated_Net_Profit_Retail_Renovation__c <= 6000, Estimated_Net_Profit_Retail_Renovation__c+500,
   IF(AND(Estimated_Net_Profit_Retail_Renovation__c > 6000 , Estimated_Net_Profit_Retail_Renovation__c <= 24000 ), Estimated_Net_Profit_Retail_Renovation__c*0.08, 
      IF(AND(Estimated_Net_Profit_Retail_Renovation__c > 24000 , Estimated_Net_Profit_Retail_Renovation__c <= 32000 ), Estimated_Net_Profit_Retail_Renovation__c*0.1, 
         IF(AND(Estimated_Net_Profit_Retail_Renovation__c > 32000 , Estimated_Net_Profit_Retail_Renovation__c<= 40000 ), Estimated_Net_Profit_Retail_Renovation__c*0.12, 
             IF(AND(Estimated_Net_Profit_Retail_Renovation__c> 40000 , Estimated_Net_Profit_Retail_Renovation__c <= 46667), Estimated_Net_Profit_Retail_Renovation__c*0.15, 
                 IF(Estimated_Net_Profit_Retail_Renovation__c > 46667 ,Estimated_Net_Profit_Retail_Renovation__c+7000, 0
                 )
             )
         )
      )
   )
)

 

All Answers

Abdul KhatriAbdul Khatri
Hi Robin,

What is the data type of Acq_Comm_Calc__c?
Robin Thomas 19Robin Thomas 19
Text
Robin Thomas 19Robin Thomas 19
Pullling from another formula field:

IF(Estimated_Net_Profit_Retail_Renovation__c <= 6000 ,'$500(flat fee)',

If(AND(Estimated_Net_Profit_Retail_Renovation__c > 6000 , Estimated_Net_Profit_Retail_Renovation__c <= 24000 ), "8%",

If(AND(Estimated_Net_Profit_Retail_Renovation__c > 24000 , Estimated_Net_Profit_Retail_Renovation__c <= 32000 ), "10%",

If(AND(Estimated_Net_Profit_Retail_Renovation__c > 32000 , Estimated_Net_Profit_Retail_Renovation__c<= 40000 ), "12%",

If(AND(Estimated_Net_Profit_Retail_Renovation__c> 40000 , Estimated_Net_Profit_Retail_Renovation__c <= 46667 ), "15%",

If(Estimated_Net_Profit_Retail_Renovation__c > 46667 , "$7000(flat fee)","")
)
)
)
)

)
Abdul KhatriAbdul Khatri
try this
IF( CONTAINS(Acq_Comm_Calc__c, '$500'), Estimated_Net_Profit_Retail_Renovation__c+500, 
	IF( CONTAINS(Acq_Comm_Calc__c, '8%'), Estimated_Net_Profit_Retail_Renovation__c*0.08, 
		IF( CONTAINS(Acq_Comm_Calc__c, '10%'), Estimated_Net_Profit_Retail_Renovation__c*0.1, 
			IF( CONTAINS(Acq_Comm_Calc__c, '12%'), Estimated_Net_Profit_Retail_Renovation__c*0.12,
				IF( CONTAINS(Acq_Comm_Calc__c, '15%'), Estimated_Net_Profit_Retail_Renovation__c*0.15, 
					IF( CONTAINS(Acq_Comm_Calc__c, '$7000'), Estimated_Net_Profit_Retail_Renovation__c+7000, 0)
				)
			)
		)
	)	
)

 
Abdul KhatriAbdul Khatri
Hi Robin,

Did it work?
Robin Thomas 19Robin Thomas 19
 Error: Compiled formula is too big to execute (50,144 characters). Maximum size is 15,000 characters


It is giving me this error
Abdul KhatriAbdul Khatri
Hi Robin,

It worked in my org.

Can you share the screen shot of it?
Robin Thomas 19Robin Thomas 19
User-added image
Abdul KhatriAbdul Khatri
My Formula is only using 554 characters

User-added image

Are you using formula into formula? There is more going on there, how you are applying this? Also you window look very different. I guess you are applying this in the formula field.
Robin Thomas 19Robin Thomas 19
Yes so the Acq_Comm_Calc__c CONTAINS and Estimated_Net_Profit_Retail_Renovation are both formula fields
Robin Thomas 19Robin Thomas 19
This is what I am trying to accomplish:

I am needing help writing out a formula field. If the net income is in a certain range I need the field to display the Net by the % it corresponds with.
=Net Income MLS Wholesale X the percentage level belows

Example: If the Net Income is $6,050 the I need this field to display: $484 (Which would be $6,050 * 0.08) Since it falls in the 8% Category


≤ $6000                     $500(flat fee)
> $6,001 ≤ $24,000     8%
> $24,001 ≤ $32,000   10%
> $32,001 ≤ $40,000   12%
> $40,001 ≤ $46,667   15%
> $46,668                 $7,000(flat fee)
Abdul KhatriAbdul Khatri
Can you share the code for the following formula fields
  • Acq_Comm_Calc__c
  • Estimated_Net_Profit_Retail_Renovation__c
Looks like all these accumulating to number of characters issue you are facing.

You mentioned Net Income, where is that in your given formula?
Robin Thomas 19Robin Thomas 19
IF(Estimated_Net_Profit_Retail_Renovation__c <= 6000),
Estimated_Net_Profit_Retail_Renovation__c+500

If(AND(Estimated_Net_Profit_Retail_Renovation__c > 6000 , Estimated_Net_Profit_Retail_Renovation__c <= 24000 ), 
Estimated_Net_Profit_Retail_Renovation__c*0.08

If(AND(Estimated_Net_Profit_Retail_Renovation__c > 24000 , Estimated_Net_Profit_Retail_Renovation__c <= 32000 ), Estimated_Net_Profit_Retail_Renovation__c*0.1

If(AND(Estimated_Net_Profit_Retail_Renovation__c > 32000 , Estimated_Net_Profit_Retail_Renovation__c<= 40000 ), Estimated_Net_Profit_Retail_Renovation__c*0.12

If(AND(Estimated_Net_Profit_Retail_Renovation__c> 40000 , Estimated_Net_Profit_Retail_Renovation__c <= 46667 ), Estimated_Net_Profit_Retail_Renovation__c*0.15
If(Estimated_Net_Profit_Retail_Renovation__c > 46667 ,Estimated_Net_Profit_Retail_Renovation__c+7000)
)
)
)

This is one I just tried and it gave me "Error: Syntax error. Extra ','"
Robin Thomas 19Robin Thomas 19
Acq_Comm_Calc__c

IF(Estimated_Net_Profit_Retail_Renovation__c <= 6000 ,'$500(flat fee)',

If(AND(Estimated_Net_Profit_Retail_Renovation__c > 6000 , Estimated_Net_Profit_Retail_Renovation__c <= 24000 ), "8%",

If(AND(Estimated_Net_Profit_Retail_Renovation__c > 24000 , Estimated_Net_Profit_Retail_Renovation__c <= 32000 ), "10%",

If(AND(Estimated_Net_Profit_Retail_Renovation__c > 32000 , Estimated_Net_Profit_Retail_Renovation__c<= 40000 ), "12%",

If(AND(Estimated_Net_Profit_Retail_Renovation__c> 40000 , Estimated_Net_Profit_Retail_Renovation__c <= 46667 ), "15%",

If(Estimated_Net_Profit_Retail_Renovation__c > 46667 , "$7000(flat fee)","")
)
)
)
)

)

Estimated_Net_Profit_Retail_Renovation__c

Estimated_Gross_ProfitRetail__c-Closing_Costs_Retail_Renovation__c

Sorry I meant Net Profit
Abdul KhatriAbdul Khatri
Even it doesn't add upto 15000 characters, something is not right.

Please correct your above formula with this, I think that may be causing the issue
IF(Estimated_Net_Profit_Retail_Renovation__c <= 6000, Estimated_Net_Profit_Retail_Renovation__c+500,
   IF(AND(Estimated_Net_Profit_Retail_Renovation__c > 6000 , Estimated_Net_Profit_Retail_Renovation__c <= 24000 ), Estimated_Net_Profit_Retail_Renovation__c*0.08, 
      IF(AND(Estimated_Net_Profit_Retail_Renovation__c > 24000 , Estimated_Net_Profit_Retail_Renovation__c <= 32000 ), Estimated_Net_Profit_Retail_Renovation__c*0.1, 
         IF(AND(Estimated_Net_Profit_Retail_Renovation__c > 32000 , Estimated_Net_Profit_Retail_Renovation__c<= 40000 ), Estimated_Net_Profit_Retail_Renovation__c*0.12, 
             IF(AND(Estimated_Net_Profit_Retail_Renovation__c> 40000 , Estimated_Net_Profit_Retail_Renovation__c <= 46667), Estimated_Net_Profit_Retail_Renovation__c*0.15, 
                 IF(Estimated_Net_Profit_Retail_Renovation__c > 46667 ,Estimated_Net_Profit_Retail_Renovation__c+7000, 0
                 )
             )
         )
      )
   )
)

 
This was selected as the best answer
Robin Thomas 19Robin Thomas 19
That worked perfect! Thank you!