Hi,
I have date converted into string, which is in the format 10-Oct-20. I am trying to extract Oct and 20. I have written a IF condition as below
If Length([Date]) = 9 then Substring([Date],3,3) else Substring([Date],2,3) Endif
I keep gettting an error "Unmatched (" in the preview section. I am unable to figure out why the issue is occuring. Could somebody shed some light on to it.
Note: I am using a older version of Alteryx hence i do not have DateTime tool. Thats why i had to convert the date from excel into string first inorder to separate the Month and Year from the Date.
Solved! Go to Solution.
I'm a big fan of IIF
iif(Length([Date]) = 9, Substring([Date], 3, 3), Substring([Date], 2, 3))
Good luck!
David
You could also just use the Text to Columns tool with the dash as the delimiter.
Hi, @hegdepavithra10
Is it possible that you have a duplicate white space somewhere?
Try this, adding Trim, and see if your result is improved.
If Length(Trim([Date])) = 9 then Substring(Trim([Date]),3,3) else Substring(Trim([Date]),2,3) Endif
Cheers!