Nested If statements

I’ve been trying to make a nested if statement work as it does on Excel. What’s worked for me on Excel was making the ‘false’ value the beginning of another If statement, such as:

if(A=Bed, Yes, if(A=Rug, No, (if A=Lamp, Maybe) ) )

But I can’t find my way round it with Coda. Has anyone tried out something similar?

Hi Adrienne and welcome to the community. :slight_smile:
Nested ifs should work the same way in Coda. For example…

But also see this post - nested ifs can usually be implemented in a much cleaner way. :wink:

1 Like

Hi Nick! Thanks so much! I’ve reviewed the samples you gave, and they’re helpful!
I think then the formula is pretty much correct but perhaps there’s something amiss with how i’m referencing other cell values. Perhaps I’m pulling too many references?

switchif(
thisRow.[PF Tier] = “Tier 1”, thisRow.Service.[PF Tier 1],
thisRow.[PF Tier] = “Tier 2”, thisRow.Service.[PF Tier 2],
thisRow.[PF Tier] = “Tier 3”, thisRow.Service.[PF Tier 3])

This basically is meant to say, if the column in this table “PF Tier” says “Tier 1”, then it should pull up the Tier 1 value of the Service (“thisRow.Service.[PF Tier 1]”) in the same row.

The column “Service” pulls up information from another table, in which the named services have 3 different tiers of pricing.

I’m quite new to this, sorry if this is a bit long! Appreciate the help. :slightly_smiling_face:

I have a feeling the problem is with “thisRow.Service.[PF Tier 1]”

If you put the cursor at the end and press “.” does it offer column choices? It might be that you’re trying to use a row reference rather than an actual value from that row.

Would it be possible to share the doc?

/edit - I’ve updated the example above to include references like what you describe (I think!) I’m not sure what the purpose of the switchif() statement is as Coda can do the lookup for you.

1 Like