How to clean up and format very messy date and non-date date

rujedi

New Member
Joined
Aug 7, 2017
Messages
4
Hello everyone,
Big fan of the Mr. Excel forum, and first time posting. Thanks in advance for any advice!

A small nonprofit that I am helping gave me a dataset that tracks their donations and I am trying to clean it up for them so we can run analytics. However, the dates for each row (1 row per donation) are entered in a variety of numeric and text formats. Below is a sample of the data I have and how I will need it at the end. I prefer formulas, as I don't know VBA, but am willing to follow VBA instructions if provided. I am using Excel from the Microsoft 365 Pro Plus suite.

Also please note, that I have been discussing this over on the ExcelForum.com with partial success (link below). I will copy over formulas that got partway to the end goal outputs.
How to clean up and format very messy date data (mix of text and date)

Here is a sample of my data, where for our reference the first row are the Excel column letters and first column are the Excel rows.
Column
A) a unique identifier number (not shown in table below) so I can merge my changes back to my master dataset.
B) Date: my original date data
C) IsText: If the date is text (true) or numeric (false)
D) ShouldBe: The date in A, as an Excel date formatted here as DD-MM-YY for readability.
E) ShouldBe2: Any non-date text in A is extracted into this column
F) FixDate: Best attempt so far to convert the date, written in unformatted Excel date
G) FixDate2: FixDate reformatted to compare result
H) FixNonDate: Any non-date extraction attempts thus far into a new column.
I) Comments

For dates that are not complete (e.g. missing MM or DD), I don't mind replacing the missing values with 01.
Some of the original dates have date and non-date information. I need these in extracted into separate columns, as shows below. In a few cases, the solution formulas so far extract only part of the non-date text. If we cannot fully fix that formula, that is ok; I can manually find and fix these few instances.

BCDEFGHI
1DateIsTextShouldBeNonDateFixDateFixDate2FixNonDateComments
204-10-16False10-Apr-16389944-Oct-16FixDate2 MM & DD flipped.
309-16-2004True16-Sep-04426141-Sep-16FixDate2 DD as year, YY dropped, and 1 as new DD.
4Nov. ‘02True01-Nov-02375611-Nov-02This works.
5Jan/Feb 2011True01-Feb-11405751-Feb-11This works.
68/12/04 (scholarship)True12-Aug-04(scholarship)383298-Dec-04(scholarship)FixDate2 MM & DD flipped.
FixNonDate column ok.
7PaidTruePaidCol E to G are empty ("").
Previous solutions had these as #N/A
Paid should appear in FixNonDate with FixDate empty ("").
803/27/06False27-Mar-06464471-Mar-27FixDate2 DD as year, YY dropped,
and 1 as new DD.
902/22/04True22-Feb-04445931-Feb-22FixDate2 DD as year, YY dropped,
and 1 as new DD
102005False01-Jan-05383531-Jan-05This works.
11Deposited in
Bratislava in 2001
True01-Jan-01200123-Jun-05in Bratislava in 2001Found YY in Date, but entered it as the unformatted Excel date.
Partial extraction of non-date text into FixNonDate.

<tbody>
</tbody>


Thanks to AlKey and FlameRetired over on the ExcelForum.com thread. FlameRetired's formulas got me the closest to what I need:
Formula to extract and fix the date
Code:
=IFERROR(IF(ISNUMBER(B2)*(LEN(B2)=4),DATE(B2,1,1),IF(LEN(B2)>1,IFERROR(LOOKUP(1E+306,--LEFT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(B2,".",""),CHAR(145),""),"//","/"),"?",""),"(",""),")",""),"$",""),ROW($1:$30))),LOOKUP(1E+306,--RIGHT(B2,ROW($1:$30)))),"")),"")

Formula to extract the non-date text
Code:
=IFERROR(IF(LEN(MID(B2,FIND(" ",B2)+1,99))>4,MID(B2,FIND(" ",B2)+1,99),""),"")

Thanks again for the time and consideration!
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,214,911
Messages
6,122,196
Members
449,072
Latest member
DW Draft

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