Trouble with IF statement and date format conversion

Hi all,

I'm having a formula issue that I need human support for. [AI is failing to translate it properly].

Here's my scenario (I'm so close!):

I have an orange text column [Delayed Result Date] that sometimes contains MM/YYYY format and other times MM/DD/YYYY format.

I need to make it a (yellow) date column [Delayed Result Date Formula]. If the text column 'date' already contains the DD, then I want that exact date in the date column. If the text column is MM/YYYY, then I want the last day of the month to be in the date column.

Here's my current formula:

=IF(LEN([Delayed Result Date]@row) = 10, DATE(VALUE(RIGHT([Delayed Result Date]@row, 4)), VALUE(LEFT([Delayed Result Date]@row, 2)), VALUE(MID([Delayed Result Date]@row, 4, 2))), IF(LEN([Delayed Result Date]@row) = 7, DATE(VALUE(RIGHT([Delayed Result Date]@row, 4)), VALUE(LEFT([Delayed Result Date]@row, 2)) + 1, 1) - 1))

It is failing to translate 12/2016, but it works in all other cases.

Wondering if anyone can suggest a change to my formula that would resolve this #invalid value error.

Thank you!
Meredith

Meredith Rhodes, PhD

ClinicalTrials.gov Specialist

UW School of Medicine & Public Health

UW Clinical Trials Institute

mkrhodes@clinicaltrials.wisc.edu

Tags:

Answers

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!