Libreoffice appears to add too may end parens

I enter:
=IF(D4=”4x4”, _4x4PT∗4, IF(D4=”4x6”,_4x6PT∗e4, 0))
when I press I get:
Err:501
When I click on the cell I see:
=IF(D4=4x4”, _4x4PT∗e4, IF(D4=”4x6”,_4x6PT∗e4, 0)))
Libreoffice has “corrected” it by unbalancing the parens??

If I replace the named cell references with constants:
=IF(D4=”4x4”, 7, IF(D4=”4x6”,11, 0))
when I press I get:
Err:501
When I click on the cell I see:
=IF(D4=”4x4”, 7, IF(D4=”4x6”,11, 0)))
which eliminates the named cell references as a cause

If I eliminate the logical statements:
IF(0, 7, IF(1, 11, 0))
when I press I get:
11
which is the expected result

If I go back to the original form and add () around the comparison statements:
=IF((D4=”4x4"), _4x4PT∗e4, IF((D4=”4x6”),_4x6PT∗e4, 0))
when I press I get:
Err:501
When I click on the cell I see:
=IF((D4=”4x4"), _4x4PT∗e4, IF((D4=”4x6”),_4x6PT∗e4, 0))))
once again with too many end parens?

What is the "correct way to write this nested IF?

Thanks

Hi @jfwfmt,

Err:501 is for Invalid character; you can see that at the status bar.

Could it be that you pasted the formula and are getting the typographical double quotes () instead of the normal double quotes (")?

What is your function separator? Comma or semicolon?
You can look these at menu Tools - Options - LibreOffice Calc - Formula.
By the way, you can use the IFS function instead of nested IF functions.

Try with
=IF(D4="4x4";_4x4PT∗4,IF(D4="4x6";_4x6PT∗e4;0))
or
=IFS(D4="4x4";_4x4PT∗4,D4="4x6";_4x6PT∗e4;1;0)

Also the asterisk used in the question is not
U+002A * ASTERISK but
U+2217 ∗ ASTERISK OPERATOR
even in source as ∗
Smells like a bad copy-paste.

2 Likes

Rather
=IF(D4="4x4";_4x4PT*4;IF(D4="4x6";_4x6PT*e4;0))
(replacing one more , with ;).

Thanks.
And replacing ∗ with *. :slight_smile:
=IF(D4="4x4";_4x4PT*4;IF(D4="4x6";_4x6PT*E4;0))

This happens because I didn’t look carefully and didn’t tested (idleness due the range names). Bad for me.

(Why does this Discourse even display the two asterisks the same when formatted as code, bad).

x∗ x*
Not so if they are seen side by side. But it has fooled me. :slight_smile:

Ah well indeed me too.