Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

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

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
Question marked as Best reply

Posted on Apr 21, 2009 3:27 AM

You have to nest a few IF functions.

=IF(A1=24, "650", IF(A1<24, "*18,96", If(A1>24, "1-24 only", "")))

That's how you stated it but you really only need two IFs because if A1 isn't equal to 24 or less than 24 it must be greater than 24, no need for the last IF.

=IF(A1=24, "650", IF(A1<24, "*18,96", "1-24 only"))
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)

Apr 23, 2009 12:48 PM in response to Thomas Dam Jensen

It seems that the tax-free law has a bit of a discontinuity in it. If I am away for 23 hours I would get 23 * 18,96 = 436 but if I stay a half hour longer I get 650. That's 214 for that last hour versus 18,96 per hour for the rest of the day I was away.

Is it that the 18,96 per hour covers food and drink and 195 covers accommodations? 18,96*24+195=650

IF THEN ELSE ?

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