## [Solved] Nested IF() producing error 511

Discuss the spreadsheet application

### [Solved] Nested IF() producing error 511

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   Expand viewCollapse view
`=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
hippyer

Posts: 5
Joined: Wed Jul 31, 2019 10:33 am

### Re: nested if producing error 511

I have not worked through all the logic of your calculations but perhaps you want this
Code: Select all   Expand viewCollapse view
`=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   Expand viewCollapse view
`=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)))`
Windows 10 and Linux Mint, since 2017
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
FJCC
Moderator

Posts: 7748
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

### Re: nested if producing error 511

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
hippyer

Posts: 5
Joined: Wed Jul 31, 2019 10:33 am

Return to Calc

### Who is online

Users browsing this forum: No registered users and 18 guests