If() and date functions
Hi - I've noticed what appears to be a problem with if() and date functions.
One issue is seen here:
The "date" column is a "date column" and will only accept dates. The "year" column is a text/number column. The year column uses two different forumlas, which are shown in "column 4."
I would expect that the second line would show "2023" but if() fails - it's not clear whether the #INVALID DATA TYPE is the result of the IF() or the YEAR() or something else is going on. If I blank out the date column, the year column shows a 0 as expected.
Here's another example:
In this case, both the "date" and "new date" columns are configured as date columns. Again, the IF() in the second line is failing - I would expect it to return the same thing as in the first line. If I blank out the date, the "new date" blanks out as expected.
Is there something I don't understand about how IF is supposed to work?
thanks,
Aaron
Answers
-
Ah, solved. The problem is that if() chokes on a date as the first argument. So something like this works for the first example: if(isblank(date@row),0,date@row).
It would be nice for if() to regard any non-zero, non-blank, non-False input as logical True but obviously isn't necessary.
-
Hi @AaronO
I hope you're well and safe!
Excellent! Glad you got it working!
Be safe, and have a fantastic week!
Best,
Andrée Starå | Workflow Consultant / CEO @ WORK BOLD
✅Please support the Community by marking your post with the accepted answer/helpful. It will make it easier for others to find a solution or help to answer!
SMARTSHEET EXPERT CONSULTANT & PARTNER
Andrée Starå | Workflow Consultant / CEO @ WORK BOLD
W: www.workbold.com | E:andree@workbold.com | P: +46 (0) - 72 - 510 99 35
Feel free to contact me for help with Smartsheet, integrations, general workflow advice, or anything else.
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.8K Get Help
- 439 Global Discussions
- 138 Industry Talk
- 470 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 67 Community Job Board
- 486 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!