Conditional statement with string concatenation fails

I can’t figure out why a formula is not working. If it’s January 19, and I have this formula:
([MON]==1?[DAY_1_31]:“Jan”)

It outputs 19. If it’s Feb, then it outputs “Jan”. (This is the correct behavior)

However, in instead I use this formula:
([MON]==1?“Jan” [DAY_1_31]:“Jan”)

It prints out the formula instead of “Jan 19”. I have played around with different syntax such as:
([MON]==1?[MON_S] [DAY_1_31]:“Jan”)

But none of these work. How can I get the formula to output the “Month Date” (Jan 19 for example) when it’s January, but only “Jan” if it’s any other month?

A solution suddenly came to me. Since in both True and False conditions, I want “Jan” to appear when it’s January or any other month, I can do this:

Jan ([MON]==1?[DAY_1_31]:“”)

This prints “Jan” first and then if it is the month of January, will also include the date, but if it’s another month, it will not. This is exactly what I want.

I may have spoken too soon. It works for January as mentioned above, but when the month is Feb, I thought I could do this:

Feb ([MON]==2?[DAY_1_31]:“”)

But again it outputs the formula instead of displaying Feb followed by the date. January worked fine so I’m not sure what’s up with Feb or Mar, which I also tried.

Seems that there was something wrong with the double-quotes at the end when I copied Jan to Feb. Once I retyped the double-quotes, it worked as expected. Still not sure why Jan worked but looking at what I pasted above, it seems this site prints smart quotes rather than straight quotes, even though that’s what I’m pasting below.

Feb ([MON]==2?[DAY_1_31]:“”)

I was able to make the change and it’s working fine now.

LOL
It was a nice talk with yourself! :joy: :joy: :joy:

There is a problem with quotes, I still don’t get the difference.

But I’m glad you made it work!

1 Like

Sometimes you just have to talk it out, even if nobody is listening. It’s surprising how well that works.

1 Like

:rofl: :rofl: :rofl: :rofl:

1 Like

Note that the patient is using smart quotes. :wink:

1 Like