genericUser
genericUser

Reputation: 7158

Google sheets - Formula parse error on many conditions

I'm trying to place the above formula on Google sheets:

=IF((L2 > 0 && !(L48 >= 0) && !(L94 >= 0)) || (L2 == 0 && L48 >=0 && L94 >= 0), False, L1)

But all I'm getting is:

Error: Formula parse error.

According to benlcollins site my problem can be due to:

  1. manually type in a $ symbol to refer to an amount, but Google Sheets thinks you’re referring to an absolute.
  2. missed a “&” when concatenating text and numerical values.
  3. messed up the closing brackets.

I don't understand what is the problem with my formula.

Thanks for the help.

Upvotes: 1

Views: 159

Answers (1)

Tom Sharpe
Tom Sharpe

Reputation: 34255

It looks as though you're trying to enter a formula into the sheet using Javascript syntax. Google sheets inherits the syntax for formulas from Excel and it's completely different.

Some of the differences are:-

enter image description here

So if you apply it to your formula you get:

=IF(or(and(L2 > 0 , not(L48 >= 0) , not(L94 >= 0)) , AND(L2 = 0, L48 >=0 , L94 >= 0)), False, L1)

It might be worth adding that you will only get 'false' if the specific condition stated in the first part of your IF statement is satisfied - otherwise the IF will default to the second alternative result, L1. It would be more common to use an IF with only two arguments in a situation like this, so if the condition is satisfied you get the result stated, otherwise it defaults to false:

if(<condition>,<result>)    <= gives false if condition not satisfied.

Upvotes: 2

Related Questions