Parse dates into mm/dd/yyyy

GreyFox8991

New Member
Joined
Jul 20, 2022
Messages
23
Office Version
  1. 2016
Platform
  1. Windows
Hello Excel Community,

I have a weird request which I am hoping someone might be able to provide a solution. I have rows where dates are provided in the following format yyyy-mm-dd and contain multiple dates in that format (Example: 2023-04-062023-04-072023-04-08). What I am trying to accomplish is to reformat the dates into mm/dd/yyyy and comma delimit them into the same row. The end result would be: (04/06/2023,04/07/2023,04/08/2023).

Another caveat would be there are ID's associated with these dates and I would then need to associate one ID with one Date. For example: ID:123456 has dates (2023-04-062023-04-072023-04-08). Instead of them being on the same row we split them so there would be three rows with the same ID and the dates in the mm/dd/yyyy (or m/dd/yyyy) I referenced above. So the end result would be:
123456: 04/06/2023
123456: 04/07/2023
123456: 04/07/2023

I am attaching a screenshot to show current state and possible end states. Any insight would be greatly appreciated. Thank you to all who assist.
 

Attachments

  • Dates_Issue.PNG
    Dates_Issue.PNG
    9.9 KB · Views: 20
  • Dates_Issue_Possible_Solution.PNG
    Dates_Issue_Possible_Solution.PNG
    7.5 KB · Views: 21

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
@GreyFox8991 , can you use the xl2bb add in (link below) to post a mini workbook with some examples and (hand typed) expected results?
Images are not good for the forum users as we have recreate the data, which is detrimental to you two ways: it takes the forum member time to type all that into workbook, and they may make typos that affect the outcome. Help the forum help you!

If that is not possible, post the data in a table so the forum can at least copy and paste the values.
 
Upvote 0
Hello Awoohaw,

Below is the code for the sheet:

Book1
AB
1Current Incorrect State
2IDDate
31232023-04-062023-04-072023-04-08
4
5
6
7End State Correct Version 1
8IDDate
912304/06/2023,04/07/2023,04/08/2023
10
11
12
13End State Correct Version 2 (if possible)
141234/6/2023
151234/7/2023
161234/8/2023
Sheet1
 
Upvote 0
Current Incorrect State
IDDate
1232023-04-062023-04-072023-04-08
End State Correct Version 1
IDDate
12304/06/2023,04/07/2023,04/08/2023
End State Correct Version 2 (if possible)
1234/6/2023
1234/7/2023
1234/8/2023
 
Upvote 0
Hi, see the linked file (with 13 auxiliary columns) for a possible solution...

The formulas used in the table:
tech!A2: =IF(IncorrectState!A2="","",IncorrectState!A2)
tech!B2: =IF(A2="","",LEN(IncorrectState!B2))
tech!C2: =IF(A2="","",IF(MOD(B2,10)=0,INT(B2/10),0))
tech!D2: =IF($A2="","",IF(COLUMN()>$C2+3,"",IF(COLUMN()=4,"",",")&MID(IncorrectState!$B2,(COLUMN()-4)*10+6,2)&"/"&MID(IncorrectState!$B2,(COLUMN()-4)*10+9,2)&"/"&"/"&MID(IncorrectState!$B2,(COLUMN()-4)*10+1,4)))
EndStateV1!A2: =IF(tech!A2="","",tech!A2)
EndStateV1!B2: =CONCAT(tech!D2:M2)

Dates.xlsx

IncorrectState.png


tech.png


EndStateV1.png
 
Upvote 0
@fjns the concat function does not exist in 2016, only 2019 & newer.
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,114
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top