Need modification in code. New Condition & New Logic.

VBABEGINER

Well-known Member
Joined
Jun 15, 2011
Messages
1,232
I need help on this code..Need some modification in it..and addition of some more condition...

I really work hard to understand, but really I'm not that much, to insert any new condition..

Code:
Dim R As Long, X As Long, Cnt As Long, Data As Variant
Data = Range("B3", Cells(Rows.Count, "B").End(xlUp)).Resize(, 2)
For R = 1 To UBound(Data)
  Cnt = 0
  Data(R, 2) = ""
  For X = Len(Data(R, 1)) To 1 Step -1
    If Cnt < 4 Then
      If IsNumeric(Mid(Data(R, 1), X, 1)) Then
        Cnt = Cnt + 1
        Data(R, 2) = Mid(Data(R, 1), X, 1) & Data(R, 2)
      End If
    ElseIf Cnt = 4 Then
      Data(R, 2) = Format(Data(R, 2), "@@/01/@@")
      Data(R, 1) = Left(Data(R, 1), X)
      Cnt = 5
    ElseIf IsNumeric(Mid(Data(R, 1), X, 1)) Then
      Data(R, 1) = Left(Data(R, 1), X)
      Exit For
    End If
  Next
Next
Range("F3").Resize(UBound(Data)).NumberFormat = "mm/dd/yyyy"
Range("E3").Resize(UBound(Data), 2) = Data
 
Dear All, I really need help on this...Please revert..


Story was, previously i have limited "Form number with Date". Now some new "Form numbers" are seen.

Hence, need to incorporate this all..
In first i.e. in Col B having "Form number with Date".
Output Columns are-
Col E - Form Numbers only
Col F - Date only

can we do something..
Form Number with DateForm NumberDate (M/D/YYYY)
EPP-E122-0116EPP-E1221/1/2016
10-02-2543 (10/16 ed.)10/2/254310/1/2016---here "ed." not required
14-02-1350 (1/95 ed.)14-02-13501/1/1995---here "ed." not required
AXIS 102 A/C (06 15)AXIS 102 A/C6/1/2015
EP 4104 (06 13)EP 41046/1/2013
EP 1051-CA (07 13)EP 1051-CA7/1/2013
CC-1k11H (03/14)CC-1k11H3/1/2014
XSC-27266 (05/09)XSC-272665/1/2009
EXL 0001 0615EXL 00016/1/2015
05 PCD0071 00 03 1005 PCD0071 003/1/2010
00 ML0012 00 09 0400 ML0012 009/1/2004
IL 00 17 01 98IL 00 171/1/1998
HC00051212HC000512/1/2012
HC70010605HC70016/1/2005
IL P 001 01/04IL P 0011/1/2004
RHIC 6000 08/11RHIC 60008/1/2011
ACF-7007 Ed. 08-11ACF-70078/1/2011---here "Ed." not required
DX T1 00 11 12DX T1 0011/1/2012
DX 00 04 11 07DX 00 0411/1/2007
17-02-5205 2-9817-02-52052/1/1998
17-02-5205 7-0317-02-52057/1/2003
11-02-1220 (09/03)11-02-12209/1/2003
NOTS0021CA (09/03)NOTS0021CA9/1/2003
UTS-COVPG 7-03UTS-COVPG7/1/2003--before 7 there is one extra space…very rare it is coming
IL 00 17 02/2013IL 00 172/1/2013---here "Ed." not required
abcde (06 15)abcde6/1/2015
EPP-POL-0410EPP-POL4/1/2010
ABCDEF 02 - 01/20ABCDEF 021/1/2020
IL 1202IL 1202--no date required
17-02-52 - 01/5717-02-52 - 01/57--no date required
95863.285714283795863.2857142837--no date required
95863.28571 - 01/5795863.28571 - 01/57--no date required

<tbody>
</tbody>
 
Upvote 0

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,216,489
Messages
6,130,959
Members
449,608
Latest member
jacobmudombe

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