Statement inside a statement

I am not sure if the headtline is correct for this matter and sorry for the bad english.
I have a problem.
In the {spiller 1 point} column like to Ask if the colomn {Spil} is “Tættest Pinden” then I like to make formular 1 if it is B i like to make a nother formular. Is that not possible.
Looking forward to hear from someone out there soon.
Br. Martin

1 Like

Hi there!

If I understand correctly, you’ll want to write a formula like this…

IF({Spill} = "Tættest Pinden", 
     Formula1,
     Formula2
)

You’ll need to replace Formula1 and Formula2 with the formulas you want. Happy to help further if you need!

Hi and thanks for your reply. But i still have problem.
Can you help me with this formular:
IF({Spill} = “Tættest Pinden”,
AND({Spiller 2}>{Spiller 1},{Spiller 2}>{Spiller 3},{Spiller 2}>{Spiller 4},{Spiller 2}>{Spiller 5},{Spiller 2}>{Spiller 6},“1”,“0”),
AND({Spiller 1}<{Spiller 2},{Spiller 1}<{Spiller 3},{Spiller 1}<{Spiller 4},{Spiller 1}<{Spiller 5},{Spiller 1}<{Spiller 6},“2”,“4”)
)

Hi there! So sorry it’s taken so long to get back to you. I oddly did not get a notification that you had replied! I made a few corrections to the syntax of your formula… the following will only show a result if {Spill} = “Tættest Pinden”:

IF({Spill} = “Tættest Pinden”,
    IF(
        AND(
            {Spiller 2} > {Spiller 1},
            {Spiller 2} > {Spiller 3},
            {Spiller 2} > {Spiller 4},
            {Spiller 2} > {Spiller 5},
            {Spiller 2} > {Spiller 6}),
        “1”,
    “0”,
    IF(
        AND(
            {Spiller 1} < {Spiller 2},
            {Spiller 1} < {Spiller 3},
            {Spiller 1} < {Spiller 4},
            {Spiller 1} < {Spiller 5},
            {Spiller 1} < {Spiller 6}),
        “2”,
    “4”)
    )
)

I think your syntax is a little off. The way I read Martin’s setup, the first AND collection should be checked if {Spill} contains “Tættest Pinden”. If not, it should check the second AND collection. In your version the first IF never closes before the second one begins, so the second IF function will never be checked. I think this is what it should be:

IF(
    {Spill} = "Tættest Pinden",
    IF(
        AND(
            {Spiller 2} > {Spiller 1},
            {Spiller 2} > {Spiller 3},
            {Spiller 2} > {Spiller 4},
            {Spiller 2} > {Spiller 5},
            {Spiller 2} > {Spiller 6}
        ),
        "1",
        "0"
    ),
    IF(
        AND(
            {Spiller 1} < {Spiller 2},
            {Spiller 1} < {Spiller 3},
            {Spiller 1} < {Spiller 4},
            {Spiller 1} < {Spiller 5},
            {Spiller 1} < {Spiller 6}
        ),
        "2",
        "4"
    )
)
1 Like

Thank so much for your reply.
Sorry both of you both have tryed to copy both formula both no one works.

WOOOW i just found out that it was the " sign that was transformed to “ so now it could save the fomula… I will test it right away. Thanks again

You are so right. But I can not get it to work anyway. I get 4 no matter what numbers I put in.

Oops! Fixed the quotes above. Not sure why it’s not working. Will test locally if I can, but I might not have time until later.

okay. Can you send the new with the right Quotes, please.

I corrected my version above with the right quotes, and it works fine for me:

What type of field is {Spill}? That may be the cause. If it’s returning an array and not a string, Airtable might not ever think that it’s a match for “Tættest Pinden”.

Thanks a lot. The field “Spil” is a tekst field :slight_smile:
I need to make a score board with mini golf where the lowest numbers get most point. If it is not mini golf it is the highest number that gives most point. Do you know what I mean. That is why i need to know if it is minigolf firstly in the formula.
IF possible I also like to have a even score. Meaning if to point are the same .
Then 3 point for winning
2 point if even 0 point if loosing
You think that is posible???

Okay, I finally figured out the translation, with Google’s help: “Spil” = “Game” and “Spiller” = “Player”, so it’s making more sense now. :slight_smile:

Your comments make sense. Each player gets 3 points for winning, 2 for tying, and 0 for losing. And the calculations need to reverse if it’s mini-golf so that the lowest score wins, not the highest. I think it can be done, but I feel like the current formula is taking the wrong approach. I would likely use several formula fields to optimize the calculations of which score is the highest/lowest, how many players have that winning score, and how many points are assigned to each player depending on their win/tie/loss status. Unfortunately I won’t have time to really dig into this in more detail for a couple days, but I’m definitely eager to play with it. I’m also curious to see what solutions others come up with.