Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

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
8 replies
Sort By: 

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?

Reply

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.

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.

Reply

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

I copy/pasted your formula from your post to a spreadsheet and it worked correctly. That is why I asked if you had copy/pasted it from your spreadsheet to your post vs retyping it. If you retyped it here, copy/paste it from your post to your spreadsheet and that might fix it.

Reply

Jun 24, 2023 8:43 PM in response to Badunit

Interesting, I did retype it as the paste looked odd, created on iOS iPhone 8plus…


The copy/paste is below:

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


Do you see anything that would trigger the error?


Thanks,

Craig

Reply

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.