Extract date and specific string from text

samahiji

Board Regular
Joined
Oct 6, 2015
Messages
82
Office Version
  1. 2019
Platform
  1. Windows
Hi
I have the following table that contains everything in one cell. I want to extract the last date entered in that cell and size in the formate of (00/00").
That two columns should be added to the original table similar to pic below.

Extract date.JPG
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
over 16,000 columns and they cram all values in 1 cell?

this code will scan the column (below is col A) and split out the latest value

Code:
Sub ParseAllRecs()
Dim vDate, vSize, vWord
Dim i As Integer

Range("A1").Select

While ActiveCell.Value <> ""
    vWord = ActiveCell.Value
    i = InStrRev(vWord, ",")
    
    If i = 0 Then
       i = InStrRev(vWord, "set")
       If i > 0 Then vWord = Mid(vWord, i + 3)
    Else
        vWord = Mid(vWord, i + 1)
    End If
    
    i = InStrRev(vWord, Chr(34))
    vSize = Trim(Left(vWord, i + 1))
    
    i = InStrRev(vWord, "on")
    vDate = Trim(Mid(vWord, i + 2))
    
    
    ActiveCell.Offset(0, 1).Value = vSize
    ActiveCell.Offset(0, 2).Value = vDate
    
    ActiveCell.Offset(1, 0).Select  'next row
Wend
MsgBox "Done"
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,315
Messages
6,171,412
Members
452,399
Latest member
oranges

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