[Solved] Nested IF() Statement

Discuss the spreadsheet application
Post Reply
TargetDummy
Posts: 1
Joined: Sun Aug 01, 2021 6:47 pm

[Solved] Nested IF() Statement

Post by TargetDummy »

Hello,
Trying to make this nested statement work getting ERR 508 (Pair Missing) Any Help would be appreciated

=IF (C33=1;735;0,IF (C34=1;1200;0,IF (C35=1;1500;0,IF (C36=1;1800;0,IF (C37=1;2200;0)))))

the If(C33=true keeps changing to a 1) not sure how to fix that. This is putting the value in a cell when a check box in ticked (normal check box empty = false when, checked it changes to true and applies the value)
Last edited by MrProgrammer on Mon Aug 09, 2021 4:02 pm, edited 1 time in total.
Reason: Tagged ✓ [Solved]
Apache OpenOffice 4.1.10
FJCC
Moderator
Posts: 9248
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Nested IF() Statement

Post by FJCC »

The structure of the IF functions is wrong. Try

Code: Select all

=IF(C33=1;735;IF(C34=1;1200;IF(C35=1;1500;IF(C36=1;1800;IF(C37=1;2200;0)))))
TRUE has a value of 1. You can use them interchangeably.
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.
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Nested IF() Statement

Post by Villeroy »

=INDEX({735;1200;1500;1800;2200};MATCH(1;$C$33:$C$37;0))
or put the 5 numbers in some cell range, say x1:x5, and
=INDEX($X$1:$X$5;MATCH(1;$C$33:$C$37;0))
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
MrProgrammer
Moderator
Posts: 4895
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Nested IF() Statement

Post by MrProgrammer »

TargetDummy wrote:Nested IF() Statement
IF is a function. Calc doesn't have any statements.
TargetDummy wrote:=IF (C33=1;735;0,IF (C34=1;1200;0,IF (C35=1;1500;0,IF (C36=1;1800;0,IF (C37=1;2200;0)))))
=IF(SUMPRODUCT(C33:C37=1);CHOOSE(MATCH(1;C33:C37;0);735;1200;1500;1800;2200);0)

CHOOSE function
MATCH function
[Tutorial] The SUMPRODUCT function
TargetDummy wrote:Trying to make this nested statement work getting ERR 508 (Pair Missing)
Of course, since your use of the IF function is bogus. Do not guess at syntax. You can't chain IF functions together with commas!

If you need any additional assistance attach a document demonstrating the difficulty (remove confidential information then use Post Reply, not Quick Reply, and don't attach a picture instead of the document itself).

If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the subject field. Select the green checkmark icon at the same time.

[Tutorial] Ten concepts that every Calc user should know
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
Post Reply