[Solved] IF then statement not working Error 522

Discuss the spreadsheet application
Post Reply
matt621
Posts: 9
Joined: Tue May 01, 2018 6:36 am

[Solved] IF then statement not working Error 522

Post by matt621 »

=IF(E4>0;(G4=E4*1.31))

In G4 I have: =IF(E4>0;(G4=E4*1.31))

So the value of G4 is equal to the value in E4 x 1.31 unless E4 is zero

But this gives me an error 522.

Can someone explain why?

Thanks
Last edited by robleyd on Wed Aug 04, 2021 12:52 am, edited 1 time in total.
Reason: Tag [Solved]
I have no idea what to put in here. Open Office 4.1.5 on Windows7 64bit sp1
User avatar
robleyd
Moderator
Posts: 5055
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: IF then statement not working Error 522

Post by robleyd »

You have an unnecessary circular reference and no ELSE part (called OtherwiseValue in the HELP) of the IF function.

All you need in the formula is =IF(E4>0;E4*1.31) although good practice would be to include an OtherwiseValue, even though it is optional. Presumably in your case you want nothing, so use =IF(E4>0;E4*1.31;"")
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.1.2; SlackBuild for 24.2.1 by Eric Hameleers
matt621
Posts: 9
Joined: Tue May 01, 2018 6:36 am

Re: IF then statement not working Error 522

Post by matt621 »

Thank you for the help. Now one thing: if E is empty it's putitng "FALSE" or 0.00 in G. How do it get it to do nothing in G if E is zero, or empty?

Also for some reason I lost my formatting in G when I put the If statement in there. I can reformat of course but why would putting the If statement change the formatting for those cells? (If you know.)

Thanks
I have no idea what to put in here. Open Office 4.1.5 on Windows7 64bit sp1
User avatar
robleyd
Moderator
Posts: 5055
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: IF then statement not working Error 522

Post by robleyd »

How do it get it to do nothing in G if E is zero, or empty?
Presumably you are using the first formula above, without the OtherwiseValue? This will return FALSE if the Test is, well, not TRUE as you haven't specified an alternative to return. The second formula I showed will return "" or nothing.
why would putting the If statement change the formatting for those cells
Most likely you copied the formula from your web browser and simply pasted it into the spreadsheet, along with formatting from the web page? If you were to Copy / PasteSpecial and choose unformatted text, the result will almost certainly be different. Blame me :-) for not putting the formula in CODE tags, as follows.

Code: Select all

=IF(E4>0;E4*1.31)

Code: Select all

=IF(E4>0;E4*1.31;"")
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.1.2; SlackBuild for 24.2.1 by Eric Hameleers
matt621
Posts: 9
Joined: Tue May 01, 2018 6:36 am

Re: IF then statement not working Error 522

Post by matt621 »

Big THANK YOU!
I have no idea what to put in here. Open Office 4.1.5 on Windows7 64bit sp1
Post Reply