I need to get 02 or more dates from a cell, and split in new columns to calculate the diference between the dates.
It always follows the same structure: "text example from 4/2024 to 1/2029".
Maybe find the "to" and get 7 characteres from left and right. Sometimes I have more than 1 "from to" expressions in the same cell.
Thank you so much!
Follow some examples (the max "from to" I can find in the same cell are 3:
I tried to follow your expected output. I hope this helps.
I believe the Difference Months in the last row should be 23 (if "To" date is not inclusive).
Input Data
Action Description |
text text text from 4/2028 to 1/2029 |
text text text from 8/2027 to 3/2028 |
text text text from 4/2028 to 1/2029, text text text from 8/2029 to 05/2030 |
text text text from 8/2027 to 3/2028, text text text from 1/2027 to 12/2028, |
Output Data
RecordID | Action Description | From | To | FromDate | ToDate | Difference Months |
1 | text text text from 4/2028 to 1/2029 | 4/2028 | 1/2029 | 2028-04-01 | 2029-01-01 | 9 |
2 | text text text from 8/2027 to 3/2028 | 8/2027 | 3/2028 | 2027-08-01 | 2028-03-01 | 7 |
3 | text text text from 4/2028 to 1/2029 | 4/2028 | 1/2029 | 2028-04-01 | 2029-01-01 | 9 |
3 | text text text from 8/2029 to 05/2030 | 8/2029 | 05/2030 | 2029-08-01 | 2030-05-01 | 9 |
4 | text text text from 8/2027 to 3/2028 | 8/2027 | 3/2028 | 2027-08-01 | 2028-03-01 | 7 |
4 | text text text from 1/2027 to 12/2028 | 1/2027 | 12/2028 | 2027-01-01 | 2028-12-01 | 23 |
Workflow
Formula Tool
FromDate = DateTimeParse([From],"%m/%Y")
ToDate = DateTimeParse([To],"%m/%Y")
Difference Months = DateTimeDiff([ToDate],[FromDate],"month")