keep getting syntax error with IF & AND statement

Here’s my attempt at a ‘simple’ IF statement which only results in SYNTAX error:

IF(AND(B3>5.6, B3<6.6), “true”, “false”)

What am I doing wrong?!

iPhone 8 Plus

Posted on Jun 24, 2023 2:02 PM

Reply
Question marked as Top-ranking reply

Posted on Jun 24, 2023 2:19 PM

The function is fine here. Was this just an example? I ask because I don't know why you put TRUE and FALSE in quotes, unless they are standing in for something else or you needed them to be text. If TRUE/FALSE are the desired results, a simpler formula is =AND(B3>5.6, B3<6.6).


But back to the problem: If your function is giving you a syntax error, one common reason is regional. If your computer is set to a region that uses a comma as a decimal separator, the parameters in functions are separated by semicolons, not commas. And if this is the case for you, 5.6 and 6.6 would need to be 5,6 and 6,6.


=IF(AND(B3>5,6; B3<6,6); TRUE; FALSE)


If that is not it, did you copy/paste the exact formula from your spreadsheet to your post or did you retype it? If retyped, maybe you fixed the problem when you typed it in here.

8 replies
Question marked as Top-ranking reply

Jun 24, 2023 2:19 PM in response to Wanbli61

The function is fine here. Was this just an example? I ask because I don't know why you put TRUE and FALSE in quotes, unless they are standing in for something else or you needed them to be text. If TRUE/FALSE are the desired results, a simpler formula is =AND(B3>5.6, B3<6.6).


But back to the problem: If your function is giving you a syntax error, one common reason is regional. If your computer is set to a region that uses a comma as a decimal separator, the parameters in functions are separated by semicolons, not commas. And if this is the case for you, 5.6 and 6.6 would need to be 5,6 and 6,6.


=IF(AND(B3>5,6; B3<6,6); TRUE; FALSE)


If that is not it, did you copy/paste the exact formula from your spreadsheet to your post or did you retype it? If retyped, maybe you fixed the problem when you typed it in here.

Jun 24, 2023 10:22 PM in response to Wanbli61

Hi Craig,


It looks like you are using Numbers > Settings > General > Cell References: > Use header names as labels.



The formula that you pasted in your reply contains smart quotes:

IF(AND(Reading '6/24/2023 12:47 PM'>5.6,Reading '6/24/2023 12:47 PM'<6.6)”Acidic”,”N/A”)


Formula in C2:

IF(AND(Reading '24 Jun 2023 12:00 am'>5.6,Reading '24 Jun 2023 12:00 am'<6.6),"Acidic","N/A")


Regards,

Ian.

Jun 24, 2023 2:26 PM in response to Badunit

Thank you for responding.

Yes the true/false are examples. Not sure of regional settings being the U.S. I’ve always prior used the commas…

I indeed want a text response for true (which I have 3 more variations of this statement to do), and for false it could simply be an empty response. Any further ideas regarding my syntax error?

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

keep getting syntax error with IF & AND statement

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.