Calc adds extra )'s, then gives code err:508

MacOS 10.11.6, Libre Office 5.1.4.2

Here is my original formula, its a discontinuous function over a range, requiring some if statements

=IF(B31<10^-6,“NA”,IF(B31<0.00002,0.0000010099503 / B31^0.985,IF(B31<10,0.0019102931 / B31^0.2811,IF(B31<1000,0.001,“NA”’))))

Note there are 4 ('s, there for 4 )'s at the end.

When I hit return, Calc changes the formula to:

=IF(B31<10^-6,“NA”,IF(B31<0.00002,0.0000010099503 / B31^0.985,IF(B31<10,0.0019102931 / B31^0.2811,IF(B31<1000,0.001,“NA”’)))))))))

Note all the )'s at the end. It then gives an err:508. What do I do?

I also note many say to use ; between items in an If statement, but when I do Calc changes them to , .

On this webpage I have selected English, but the reCAPTCHA keeps changing to Chinese?

Your formula has an extra mark at the end of the last NA. It should be "NA".

The required ; is changed to , because of the setting in Tools->Options. Look under LibreOffice Calc->Formula.

If this answers your question please click on the :heavy_check_mark: (upper left area of answer).

CAPTCHA has had language problem for some time. No resolution at this point.

I eventually found the extra ’ , then it stopped adding all the )'s at the end but still gave an error. I eventually removed each complete If statment and put in an “n” (n=1,2,3) in its place and put the If statement in a new cell and repeated. I think there was another error in the third If statement but I don’t see it now. I eventually got it to work. But Calc adding all the )'s is very confusing.