VBA to Pick Specific details or split and get the data

exceluser9

Active Member
Joined
Jun 27, 2015
Messages
388
On Column B I have list of different types of descriptions and on column C , D & E I wanted few details from column B (descriptions) as per below example. So where ever the description starts with intelnumr I need a VBA code to pick below details as per below example. For the ones which does not start intelnumbr it should be blank on column C, D & E.
And on column C, D & E if it is already updated with any value VBA code should skip that line and fill only for blank cells on column C,D & E.


Column B
Column C
Column D
Column E
intelnumr ID G32164317 - N TILDA RICE 2.652 SV 0.65 - 052289169 - TILDA BASMATIwir - 201652
G32164317
52289169
201652

<tbody>
</tbody>

Below are few lines which I have.
When the VBA is executed check for intelnumr on descriptions and update required value on column C,D& E if these columns already have a value inputted it should ignore and go to next line. And this data will increase everyday

Column A
Column B
Column C
Column D
Column E
1234
intelnumr ID G32164317 - N TILDA RICE 2.652 SV 0.65 - 052289169 - TILDA BASMATIwir - 201652
G32164317
52289169
201652
1235
intelnumr ID G32254314 - N1 TILDA RICE 2.652 SV 0.65 - 051098169 - TILDA BASMATI BROWN RICE 500G - 201652
G32254314
51098169
201652
1236
intelnumr ID G32156396 - N1 TILDA RICE 1.391 SV 0.39 - 081475253 - TILDA PULSES EDAMAME 140G - 201652



1237
D# 123348123 Coffee - P17 Gate Fee - Euro Food Brands: TPNB - 53847432 : S Ref GRO_22420_47323 : N



1238
D# 123348123 Coffee - P17 Gate Fee - Euro Food Brands: TPNB - 53847432 : S Ref GRO_22420_47323 : N



1239
D# 123348123 Coffee - P17 Gate Fee - Euro Food Brands: TPNB - 53847432 : S Ref GRO_22420_47323 : N



1240
intelnumr ID G32135372 - N1 BETTY CROCKER COFFEE ICING 2.252 SV 0.25 - 079659776 - BETTY CROCKER COFFEE ICING 400G - 201652



1241
intelnumr ID G32154788 - KNORR STOCK CUBES 1.51 SV 0.5 - 051021404 - KNORR FISH STOCK CUBES 8 X 10G - 201652



1242
claim PD 20/02/2017 TO 26/02/2017 2591627 SPAM CHOP HAM&PORK 340G



1243
claim PD 20/02/2017 TO 26/02/2017 16535720 JRDNS NATURAL MUSLI 1KG



1244
21327959 BOUNTY 4 PACK 228G



1245
29621961 OEP S N STFF DIN KIT 312



1246
intelnumr ID G32174317 - N TILDA RICE 2.652 SV0.65 - 052288169 - TILDA BASMATIwir - 201652




<tbody>
</tbody>
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
These are the below set of all the example I have found there will nothing apart from this.
For the below first line there is no 8digit number after G32345965 in the middle then don’t need any out put it should be blank.

And there are few example like – and 8 digit number or there is no – before or after 8 digit number.


Column A
Column B
Column C
Column D
Column E
1
intelnumr ID G32345965 - ETH N1 YUTAKA SOUP 1.58>1.08 SV 0.5 YUTAKA YELLOW MISO SOUP 50G - 201751



2
intelnumr ID G32345965 - ETH N1 YUTAKA SOUP 1.58>1.08 SV 0.5 - 076296758 - YUTAKA YELLOW MISO SOUP 50G - 201751
G32345965
76296758
201751
3
intelnumr ID G32345965 - ETH N1 YUTAKA SOUP 1.58>1.08 SV 0.5 076296748 - YUTAKA YELLOW MISO SOUP 50G - 201752
G32345965
76296748
201752
5
intelnumr ID G32345965 - ETH N1 YUTAKA SOUP 1.58>1.08 SV 0.5 076296768 YUTAKA YELLOW MISO SOUP 50G - 201754
G32345965
76296768
201754

<tbody>
</tbody>
 
Upvote 0
Try this version
Code:
Sub Split_Data_v2()
  Dim c As Range

  Application.ScreenUpdating = False
    For Each c In Range("B1", Range("B" & Rows.Count).End(xlUp))
        If Left(LCase(c.Value), 12) = "intelnumr id" Then
          If c.Resize(, 4).SpecialCells(xlConstants).Cells.Count < 4 Then
            If Right(Left(c.Value, InStrRev(c.Value, " - ", Len(c.Value) - 10) - 1), 9) Like "#########" Then
              c.Offset(, 1).Value = Mid(c.Value, 14, 9)
              c.Offset(, 2).Value = Right(Left(c.Value, InStrRev(c.Value, " - ", Len(c.Value) - 10) - 1), 9)
              c.Offset(, 3).Value = Right(c.Value, 6)
            End If
          End If
        End If
    Next c
  Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,082
Messages
6,128,717
Members
449,464
Latest member
againofsoul

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