0

When I'm trying to perform a calculation in a formula field(Number) in salesforce, I'm getting an syntax error.

IF(
    ((Forecast_Tons__c – Minimum_Range_Value__c) * Applied_Benefits__c) < 0,
    0,
    1
)

Datatypes

1.Forecast_Tons__c - Number(18, 0)

2.Minimum_Range_Value__c - Number(16, 2)

3.Applied_Benefits__c - Number(14, 4)

Please help me out on this. I have already tried all the possible paranthesis combinations.

enter image description here

2
  • 1
    There's gotta be more to that error message. Knowing what the entirety of the error message is saying is important, so pleas edit your question to add that. Beyond that, let's go over some basic sanity checks. - Are you treating blanks as blanks, or as zeros? - Are all of these fields on the same object? - Is the FLS for these fields set so that you can access the fields (FLS isn't carried over if the fields were deployed from another org)?
    – Derek F
    Commented Aug 28, 2022 at 11:51
  • @DerekF Treating blank fields as zeros.. Yes all fields on same object. FLS is visible for all the profiles. Commented Aug 28, 2022 at 12:43

1 Answer 1

2

Please Direct use this formula directly in your formula field.

IF(
((Forecast_Tons__c - Minimum_Range_Value__c) * Applied_Benefits__c) < 0,
0,
1)

I was able to reproduce the same thing at my end, here is the way I resolved it. If still not work, then create a short formula, check syntax then apply final formula. You may write a short formula to syntax only, i.e

IF(
Forecast_Tons__c < 0,
0,
1)

And Other Formula to check Syntax only (Click on Check Syntax Button)

IF(
(Forecast_Tons__c - Minimum_Range_Value__c) < 0,
0,
1)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .