IF THEN ELSE ?

Hey there !
I´m quite new to Numbers, and I can´t seem to find a formula that works for me. What I need is to build a formula like this, IF (a1 = 24 THEN = "650") ELSE IF (a1 <24 THEN *18,96) ELSE IF (a1>24 THEN "1-24 only")

I hope someone can help me.

Thomas Dam Jensen

MacBook, Mac OS X (10.5.6)

Posted on Apr 21, 2009 2:54 AM

Reply
12 replies

Apr 21, 2009 1:15 PM in response to Thomas Dam Jensen

Thomas,

You are just missing the syntax, which is clearly explained in the Formulas and Functions User Guide. There is also an easy way to get the syntax for any function, and that is to insert the function using the Function Browser. When you do that you get a fill-in-the-blanks method for observing the syntax.

Here's an example for IF:

User uploaded file

When using the function inserted from the browser, you just click on a parameter and then fill in in or select it in the table.

Regards,

Jerry

Apr 21, 2009 1:30 PM in response to Thomas Dam Jensen

Thomas Dam Jensen wrote:
I already did, I´m just to stupid..... so mabye you can explain it to me ?


I am unable to decide if you tell the truth 😉

Go to page 150 of Formulas and Functions User Guide.
The IF description is really clear.

Applying it I built:
=IF(A1=24,650,IF(OR(A1>24,A1<1),"1-24 only",A1*18.96))

which is more complete than your original pseudo-code.

Yvan KOENIG (from FRANCE mardi 21 avril 2009 22:29:37)

Apr 21, 2009 2:46 PM in response to Thomas Dam Jensen

Thomas, I wasn't sure what you were expecting from the IF statement. I put all the results in quotes because your first result was in quotes, though it was a number, and your last result looked like a string and "*18,96" didn't make sense as a formula. Did you mean A1*18,96 (I am assuming your decimal is a comma)?

Is there anything else you need answered or does it now make sense?

Apr 23, 2009 6:37 AM in response to Thomas Dam Jensen

Thomas Dam Jensen wrote:
Hey Thanks !!
I Just replaced the commas with semicolon, ´cause in Scandinavia we use commas as decimal separator and periods for 1.000, 100.000, 1.000.000 ect, ect ,so when I use comma as formula separator, Numbers just got all confused!

This works for me.
=IF (A1=24 ; "650" ; IF (A1<24; A1*18,96 ; "Only 1-24"))


This formula returns an odd result if A1 is empty or negative.
with 0 it returns 0
with -1 it returns -18,96

To get a correct behavior you must swap and complete the tests.
=IF(OR(A1<1;A1>24);"Only 1-24";IF(A1=24;"650";A1*18,96 ))

Yvan KOENIG (from FRANCE jeudi 23 avril 2009 15:37:05)

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.

IF THEN ELSE ?

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