Upcoming database upgrades. to improve our reliability at 03:30 UTC on Feb. 25 / 7:30pm PT on Feb. 24. Some users may briefly experience slow load times or error messages. Learn more here

If Statement Formulas

Topic Labels: Formulas
149 2
Showing results for 
Search instead for 
Did you mean: 

Hi there! I am a little stumped on creating these 2 formulas with a few different layers. All of my Commuity requests are about Iff statements- they hurt my brain, but I love them!

If an If statement is not the best approach, please let me know :slightly_smiling_face:

Formula 1
Display the word “Block” if a status is blocked, and if it does not say “Block” it shows the date/time/type of the webinar. What am I doing wrong here?

DATETIME_FORMAT(SET_TIMEZONE({Start Date/Time}, 'America/Los_Angeles'),'MM/DD/YY h:mm A PT')&"-"&{Type})

Second Formula
The second one works as is below but I want to add a second webinar type that would return the “Sponsor” name field in the results.

If the webinar type is Sponsor OR Sponsored Survey, display date-sponsor-topic, ELSE display “date-webinar type-topic”

IF({Webinar Type}='Sponsor',DATETIME_FORMAT(Date, "MM-DD-YYYY")&" - "&Sponsor&" - "&Topic, DATETIME_FORMAT(Date, "MM-DD-YYYY")&" - "& {Webinar Type}&" - "&Topic)

Any help would be appreciated, thank you! I get a little stumped when my formulas get complicated :slightly_smiling_face:

2 Replies 2

Hey @beder!

Re. Formula #1

Hmmmm… how is your formula behaving right now, and how does it differ from what it should be doing?
I haven’t plugged it into a playground to test it, but in terms of syntax, it seems sound and follows the logic you described.

    {Status} = "Block",
            {Start Date/Time},
        'MM/DD/YY h:mm A PT'
    ) & "-" & {Type}

Re. Formula #2

This formula follows the logic you described:

        {Webinar Type} = 'Sponsor',
        {Webinar Type} = 'Sponsored Survey'
    ) & " - " & {Sponsor} & " - " & {Topic},
    ) & " - " & {Webinar Type} & " - " & {Topic}

There are a few instances where I can see this formula behaving in a weird way, but at least in a vacuum, this formula hits those requirements.

Thank you! That worked :slightly_smiling_face: