Text to Date Field

Hi,
I've been looking at the community board for a formula to convert a text date (ie. 05/21/21) to a DATE type data entry in a new column. Any suggestions?
Thanks,
John
Best Answer
-
Hi @John Stanik
Will your text entry always have the exact same format of mm/dd/yy?
You can use the DATE function to translate numbers into Dates, with the syntax being DATE(YYYY, MM, DD).
In this instance, we'll want to use the VALUE Function around each number set we're grabbing, like so:
DATE(VALUE(20 + YY), VALUE(MM), VALUE(DD))
Then we can use the RIGHT Function, MID Function, and LEFT Function to grab different elements of your text string.
DATE(VALUE(20 + RIGHT(YY)), VALUE(LEFT(MM)), VALUE(MID(DD)))
For the MID portion, we'll need to use a FIND Function to find the starting position (a number) of whatever it is looking for, in this case a "/". The formula uses the number it finds as a starting position in the text string.
Full Formula:
=DATE(VALUE(20 + RIGHT([Text Column]@row, 2)), VALUE(LEFT([Text Column]@row, 2)), VALUE(MID([Text Column]@row, FIND("/", [Text Column]@row) + 1, 2)))
You'll need to enter the formula into a Date Column. Let me know if this works and makes sense!
Cheers,
Genevieve
Need more information? π | Help and Learning Center
γγγ«γ‘γ― (Konnichiwa), Hallo, Hola, Bonjour, OlΓ‘, Ciao!π | Global Discussions
Answers
-
Hi @John Stanik
Will your text entry always have the exact same format of mm/dd/yy?
You can use the DATE function to translate numbers into Dates, with the syntax being DATE(YYYY, MM, DD).
In this instance, we'll want to use the VALUE Function around each number set we're grabbing, like so:
DATE(VALUE(20 + YY), VALUE(MM), VALUE(DD))
Then we can use the RIGHT Function, MID Function, and LEFT Function to grab different elements of your text string.
DATE(VALUE(20 + RIGHT(YY)), VALUE(LEFT(MM)), VALUE(MID(DD)))
For the MID portion, we'll need to use a FIND Function to find the starting position (a number) of whatever it is looking for, in this case a "/". The formula uses the number it finds as a starting position in the text string.
Full Formula:
=DATE(VALUE(20 + RIGHT([Text Column]@row, 2)), VALUE(LEFT([Text Column]@row, 2)), VALUE(MID([Text Column]@row, FIND("/", [Text Column]@row) + 1, 2)))
You'll need to enter the formula into a Date Column. Let me know if this works and makes sense!
Cheers,
Genevieve
Need more information? π | Help and Learning Center
γγγ«γ‘γ― (Konnichiwa), Hallo, Hola, Bonjour, OlΓ‘, Ciao!π | Global Discussions
-
Thank you so much @Genevieve P. , that worked. I appreciate the detailed breakdown of how it works! That totally helps me understand the logic.
Best,
John
-
@Genevieve P. I'm trying to use the formula that you suggested but am getting #Invalid Value. Here is the value I'm attempting to pull and the formula modified from what you suggested above:
Formula: =DATE(VALUE(20 + RIGHT([FY22 W46]2, 2)), VALUE(LEFT([FY22 W46]2, 2)), VALUE(MID([FY22 W46]2, FIND("/", [FY22 W46]2) + 1, 2)))
Text Field: 08/14/22
Edit: I think I figured out the issue - the column is a text column. Is it possible to make a single cell at the very top a date cell? I need to do some formulas to show if the date is equal to today's date.
-
Hi @Sarah123
The DATE function above is what we're using to turn a text cell into a Date. You can compare this to Today's Date using the TODAY function!
For example:
=IF(DATE(formula) = TODAY(), value if true, value if false)
Does that help?
Need more information? π | Help and Learning Center
γγγ«γ‘γ― (Konnichiwa), Hallo, Hola, Bonjour, OlΓ‘, Ciao!π | Global Discussions
-
Oh, in my case it may be much harder..
-
Hi @Volodymyr L
It looks like you've been working through this on another thread, here, and Debbie has some great suggestions for you!
Need more information? π | Help and Learning Center
γγγ«γ‘γ― (Konnichiwa), Hallo, Hola, Bonjour, OlΓ‘, Ciao!π | Global Discussions
-
Thank you very much Smartsheet team for your awesome programm!!!!!!!!!!
Yup, i`m glad with here help
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 67K Get Help
- 441 Global Discussions
- 154 Industry Talk
- 502 Announcements
- 5.4K Ideas & Feature Requests
- 85 Brandfolder
- 156 Just for fun
- 79 Community Job Board
- 512 Show & Tell
- 34 Member Spotlight
- 2 SmartStories
- 307 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!