0

using if else in formula field

Hello people, I am stuck in a condition where I want to show values of one field (Status1) to a formula field (Status0).

I write a code in Status0 formula field which is mentioned below.

if text(Status1) = "lead" then
    = "empty"
else
    if text(Status1) = "offer" then
        = "entworfen"
    else
        if text(Status1) = "offer" or text(Status1) = "angeboten" or text(Status1) = "reserviert" then
            = "entworfen"
        else
            if text(Status1) = "won" then
                = "gewonnen"
            else
                if text(Status1) = "lost" then
                    = "verloren"
                end
            end
        end
    end
end

But it is not showing me the values in formula field (Status0).

 

Thanks in Advance. :) 

2 replies

null
    • John_Halls
    • 1 yr ago
    • Reported - view

    If this is in a formula field then remove the equals signs

    if text(Status1) = "lead" then
        "empty"
    else
        if text(Status1) = "offer" then
            "entworfen"
        else
            if text(Status1) = "offer" or text(Status1) = "angeboten" or text(Status1) = "reserviert" then
                "entworfen"
            else
                if text(Status1) = "won" then
                    "gewonnen"
                else
                    if text(Status1) = "lost" then
                        "verloren"
                    end
                end
            end
        end
    end
    
    

    Three things I noticed

    1. Did you want the lead value to be the word "empty" or did you want to be empty?
    2. You have repeated the offer condition
    3. With multiple if..then statements it can be better to use a switch statement

    If I am right this could become

    switch text(Status1) do
    case text(Status1) = "offer" or text(Status1) = "angeboten" or text(Status1) = "reserviert":
    "entworfen"
    case "won":
    "gewonnen"
    case "lost":
    "verloren"
    end
    

    I think the empty option will take case of itself here.

    Regards John

      • John_Halls
      • 1 yr ago
      • Reported - view

      Sorry, that should be

      switch text(Status1) do
      case text(Status1) = "offer" or text(Status1) = "angeboten" or text(Status1) = "reserviert":
      "entworfen"
      case text(Status1) = "won":
      "gewonnen"
      case text(Status1) = "lost":
      "verloren"
      end
      
      

Content aside

  • 1 yr agoLast active
  • 2Replies
  • 197Views
  • 2 Following