[Solved] Nested IF() producing error 511

Discuss the spreadsheet application
Post Reply
hippyer
Posts: 5
Joined: Wed Jul 31, 2019 10:33 am

[Solved] Nested IF() producing error 511

Post by hippyer »

Please can I get some help making this nested if statement work?

I'd like it to perform a different calculation if b15="BTC". I must have some semi colons or brackets out of place, but I can't figure it out for myself :(

Code: Select all

=IF(ISBLANK(F15);"";IF((B15)="BTC";IF((F15)="Long";((C15/E15)-H15-G15)-((C15/D15)-H15-G15);IF((F15)="Short";((C15/D15)-(C15/E15))/(C15/D15)-H15-G15)));IF((F15)="Long";((E15*C15)-H15)-((D15*C15)-H15-G15));IF((F15)="Short";(D15-E15)/D15-H15-G15;))
Last edited by Hagar Delest on Thu Sep 17, 2020 8:37 am, edited 1 time in total.
Reason: tagged solved.
Apache Open Office 4.1.2
Windows 8.1
FJCC
Moderator
Posts: 9278
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: nested if producing error 511

Post by FJCC »

I have not worked through all the logic of your calculations but perhaps you want this

Code: Select all

=IF(ISBLANK(F15);"";IF((B15)="BTC";IF((F15)="Long";((C15/E15)-H15-G15)-((C15/D15)-H15-G15);IF((F15)="Short";((C15/D15)-(C15/E15))/(C15/D15)-H15-G15));IF((F15)="Long";((E15*C15)-H15)-((D15*C15)-H15-G15);IF((F15)="Short";(D15-E15)/D15-H15-G15))))
or this somewhat simplifed version

Code: Select all

=IF(ISBLANK(F15);"";IF((B15)="BTC";IF((F15)="Long";((C15/E15)-H15-G15)-((C15/D15)-H15-G15);((C15/D15)-(C15/E15))/(C15/D15)-H15-G15);IF((F15)="Long";((E15*C15)-H15)-((D15*C15)-H15-G15);(D15-E15)/D15-H15-G15)))
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
hippyer
Posts: 5
Joined: Wed Jul 31, 2019 10:33 am

Re: nested if producing error 511

Post by hippyer »

Thank you very much for your help. It seemed that indeed some of the logic of my calculations was incorrect, but your suggestions did parse without any error code and I have been able to make the necessary adjustments. Much appreciated.
Apache Open Office 4.1.2
Windows 8.1
Post Reply