SOLVED

Data consolidation to compute duration in years between to different format of Dates.

%3CLINGO-SUB%20id%3D%22lingo-sub-2488058%22%20slang%3D%22en-US%22%3EData%20consolidation%20to%20compute%20duration%20in%20years%20between%20to%20different%20format%20of%20Dates.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2488058%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20everyone%2C%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20calculate%20the%20period%20of%20time%20between%20dates%20that%20have%20been%20set%20with%20different%20formats%20(some%20times%20year%20only%2C%20other%20month-year%2C%20others%20the%20extended%20date).%20For%20sake%20of%20clarity%20and%20for%20a%20better%20understanding%20of%20my%20query%2C%20please%20refer%20to%20the%20below%20print%20screen%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Bezz8_0-1624715309117.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F291597i05897C933CC59530%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Bezz8_0-1624715309117.png%22%20alt%3D%22Bezz8_0-1624715309117.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3ESince%20the%20file%20is%20including%20200k%20raws%2C%20does%20someone%20has%20any%20idea%20on%20how%20to%20homogenize%20the%20dates%20format%20in%20order%20to%20smoothly%20compute%20the%20timing%20between%20start%20%26amp%3B%20end%20date%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20a%20lot%20in%20advance%20to%20the%20ones%20that%20will%20provide%20useful%20tips.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2488058%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%20on%20Mac%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2488227%22%20slang%3D%22en-US%22%3ERe%3A%20Data%20consolidation%20to%20compute%20duration%20in%20years%20between%20to%20different%20format%20of%20Dates.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2488227%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1088760%22%20target%3D%22_blank%22%3E%40Bezz8%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELet's%20say%20your%20data%20are%20in%20columns%20A%20and%20B.%3C%2FP%3E%0A%3CP%3EIn%20C2%2C%20enter%20the%20formula%20%3DIF(LEFT(CELL(%22format%22%2CA2))%3D%22D%22%2CA2%2CDATE(A2%2C1%2C1))%3C%2FP%3E%0A%3CP%3EThis%20will%20replace%20a%20year%20with%20January%201%20of%20that%20year.%20As%20an%20alternative%2C%20you%20might%20use%20July%201%20-%20the%20middle%20of%20the%20year%2C%20as%20best%20guess%20of%20the%20date%3A%20%3DIF(LEFT(CELL(%22format%22%2CA2))%3D%22D%22%2CA2%2CDATE(A2%2C7%2C1))%3C%2FP%3E%0A%3CP%3EFill%20to%20the%20right%20to%20D2.%3C%2FP%3E%0A%3CP%3EIn%20E2%2C%20enter%20the%20formula%20%3DIFERROR(DATEDIF(C2%2CD2%2C%22Y%22)%2C%22---%22)%3C%2FP%3E%0A%3CP%3ESelect%20C2%3AE2%2C%20and%20fill%20down%20to%20the%20end%20of%20the%20data.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22S0543.png%22%20style%3D%22width%3A%20591px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F291609iDB46B1DA3476B5BA%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22S0543.png%22%20alt%3D%22S0543.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hello everyone, 

 

I am trying to calculate the period of time between dates that have been set with different formats (some times year only, other month-year, others the extended date). For sake of clarity and for a better understanding of my query, please refer to the below print screen:

Bezz8_0-1624715309117.png

Since the file is including 200k raws, does someone has any idea on how to homogenize the dates format in order to smoothly compute the timing between start & end date? 

 

Thank you a lot in advance to the ones that will provide useful tips.  

2 Replies
best response confirmed by allyreckerman (Microsoft)
Solution

@Bezz8 

Let's say your data are in columns A and B.

In C2, enter the formula =IF(LEFT(CELL("format",A2))="D",A2,DATE(A2,1,1))

This will replace a year with January 1 of that year. As an alternative, you might use July 1 - the middle of the year, as best guess of the date: =IF(LEFT(CELL("format",A2))="D",A2,DATE(A2,7,1))

Fill to the right to D2.

In E2, enter the formula =IFERROR(DATEDIF(C2,D2,"Y"),"---")

Select C2:E2, and fill down to the end of the data.

 

S0543.png

Hello Hans,

I would like to thank you a lot for your prompt reply.
Thanks to your suggestion I solved the issue and you allowed me to save who knows how many hours of work on that excel sheet. You definitely made my day.

Thank you again for sharing your knowledge, very appreciated!