I have on a daily basis text dates ranging from four digits to eight digits. I have developed VBA code to clean up for me. I have been unable to come up with a way to clean this up in power query using transform. It's frustrating because I can do all the other cleanup but unable to clean up this one field. I have an M for data monkey and have searched the web and have found nothing I could use as a solution
Here is what the dates look like all different lengths
here is my VBA code that does the job.
Is this possible in powerquery ?
looking to do all transform and prep using powerquery. Any help and direction would be greatly appreciated.
Here is what the dates look like all different lengths
Date |
91616 |
10232016 |
111315 |
7116 |
here is my VBA code that does the job.
Code:
Sub ChangeTextToDate()
Dim r As Range
Dim cell As Range
Dim d As Double
On Error Resume Next
Set r = ActiveWindow.RangeSelection.SpecialCells(xlCellTypeConstants, xlNumbers).Cells
If Err.Number Then GoTo NothingToDo
For Each cell In r.Cells
If VarType(cell.Value) <> vbDate Then
d = Int(cell.Value2)
Select Case d
Case 1000 To 9999
cell.Value = CDate(Format(d, "0-0-00"))
Case 10000 To 999999
cell.Value = CDate(Format(d, "0-00-00"))
Case Is > 100000
cell.Value = CDate(Format(d, "0-00-0000"))
End Select
End If
Next cell
NothingToDo:
End Sub
Is this possible in powerquery ?
looking to do all transform and prep using powerquery. Any help and direction would be greatly appreciated.