VBA to extract multiple substrings into another worksheet

tdub4034

New Member
Joined
Mar 25, 2015
Messages
14
Office Version
  1. 2016
Platform
  1. Windows
I have around 180 records that have an 80 character string where one row (H1 *) contains an account number the next row (R12*) that contains detail that needs to be separated into different columns on another worksheet. I can use a MID function to extract but I think it would be more efficient to use VBA extract needed data. Below is the criteria:
All in need from the "H1 *" rows are the 4th through 15th characters - this is the account number. For this I used the
=MID(A2,4,15) .
Below that I use the following "MID" statements for the "R12" row:
=MID($A$3,4,13), =MID(A3,14,3), =MID(A3,17,6), =MID(A3,23,10), =MID(A3,33,6), =MID(A3,39,32)

Below are sample records:
H1 000002144581416R12050416050416050416
R1200000101660570419160000034947050416Red Summit Energy
R1200000101860570426160000001260050416Marial Delgado
R1200000101880570426160000000840050416Roberto Garcia
H1 000002798929366R12050416050416050416
H1 000002798965394R12050416050416050416
R1200000015360570419160000134458050416Men Unlimited
H1 000002799001298R12050416050416050416
R1200000018440570421160000001638050416Francis Garcia
R1200000018510570425160000092298050416FarAway Communications
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
To help helpers, please publish a spreadsheet to show where the data are and the results should be. For some data enter the required results manually.
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

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