Null in IF condition
How do I represent null in the else clause of if statement? A blank pair of double quotes ("") is not working. I want to concatenate values is a few columns if a column is not blank. If the column is blank, I want the if statement to return null.
This code works, but I want the value in "SEQ#" to be left padded with zeros for up to 2 digits.
I want the final value in the cell to be, for example: "JD-18-01" and not "JD-18-1".
=IF(NOT(ISBLANK([Story summary]@row)), [Assigned To]@row + "-" + [Sprint#]@row + "-") + [Seq#]@row
Answers
-
Essentially, there are two issues here.
- The value of the last column to be 01 instead of 1 (for example "JD-18-01" and not "JD-18-1".
- If the value in [Story Summary]@row is blank, do not populate anything, in other words, leave it blank.
-
Solving for #2 first is as simple as moving that closing parenthesis after the second "-" to the very end of the formula:
=IF(NOT(ISBLANK([Story summary]@row)), [Assigned To]@row + "-" + [Sprint#]@row + "-" + [Seq#]@row)
Solving for #1 requires a RIGHT statement that looks like this:
=IF(NOT(ISBLANK([Story summary]@row)), [Assigned To]@row + "-" + [Sprint#]@row + "-" + RIGHT("0" + [Seq#]@row, 2))
-
Thanks, Paul. That works great. I will try to understand how it works. I did not expect RIGHT function to work here. Thanks again.
-
Happy to help. 👍️
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 63.5K Get Help
- 402 Global Discussions
- 213 Industry Talk
- 450 Announcements
- 4.7K Ideas & Feature Requests
- 141 Brandfolder
- 135 Just for fun
- 56 Community Job Board
- 454 Show & Tell
- 31 Member Spotlight
- 1 SmartStories
- 296 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!