Предполагая, префикс пребывания «Debit_Coverage_Report» для всех ваших строк и «_1_2_2016» находится в хронологическом порядке от dd_mm_yyyy
(01-Feb-2016), попробуйте следующий код (решение VBA):
Option Explicit
Sub ExtractDate()
Dim LastRow As Long, i As Long, ind As Long
Dim MyArr As Variant
Dim DateArr() As Date
' init Date array to a lrage size on init >> will optimize it's size later in the code
ReDim DateArr(0 To 1000)
ind = 0 ' <-- init DateArr array index
' modify "Sheet1" to your sheet's name
With Sheets("Sheet1")
' in my test all data is in column B, so looking for last row with value in column B
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
' loop through all cells in columns B
For i = 2 To LastRow
If .Range("B" & i).Value <> "" Then ' <-- check if the cell is not empty
MyArr = Split(.Range("B" & i).Value, "_") ' <-- split the string to array elements
DateArr(ind) = DateSerial(MyArr(5), MyArr(4), MyArr(3)) ' <-- inserting the array to DateArr array
' the line below is just to show you the results on column C (next to your original string)
.Range("C" & i).Value = DateArr(ind)
ind = ind + 1
End If
Next i
ReDim Preserve DateArr(0 To ind - 1) ' <-- resize array to number of array elements found in worksheet
End With
End Sub
снимок экрана ниже показывает результаты в колонке C после выполнения этого кода
является префиксом «Debit_Coverage_Report_ ВСЕГДА»? –
А где дата и другие цифры? час/мин/сек? Debit_Coverage_Report_dd_mm_yyyy_hh_mm_ss? Итак, отчет 1 - 1 февраля 2016 года? – dgorti
@sagar вы проверили какой-либо ответ ниже? они работали? любая обратная связь? –