Data Text to Column

decent_boy

Board Regular
Joined
Dec 5, 2014
Messages
130
Office Version
  1. 2016
Platform
  1. Windows
Hi
I copy below data from a text file and issue is that when I convert/copy multiple rows to Result Sheet, it takes too much time. Please provide any VBA solution to save time

Date Copied from Text File
Sheet1


A
1Order No = A25/CP/0123/00333
2Order Amount = 12351
3SH_ID = TA5
4
5-------------------------------------------------------------------------------------------------------------------------------------------------------------
6| SP |Type |Denomination |From |To | Quantity| |
7-------------------------------------------------------------------------------------------------------------------------------------------------------------
8|DS1|EU |ITEM-232 |0101250300225100 |0101250300225199 | 100|SMITH |
9|DS1|EU |ITEM-324 |0600528600210000 |0600528600210199 | 200|SMITH |
10|DS1|EU |ITEM-524 |0005084901091890 |0005084901091919 | 30|SMITH |
11
12Order No = A32/CP/0152/00352
13Order Amount = 726
14SH_ID = TA9
15
16-------------------------------------------------------------------------------------------------------------------------------------------------------------
17| SP |Type |Denomination |From |To | Quantity| |
18-------------------------------------------------------------------------------------------------------------------------------------------------------------
19|DS2|EU |ITEM-232 |0101250300225200 |0101250300225299 | 100|JHON |
20
21Order No = A33/CP/0192/00395
22Order Amount = 8252
23SH_ID = TA2
24
25-------------------------------------------------------------------------------------------------------------------------------------------------------------
26| SP |Type |Denomination |From |To | Quantity| |
27-------------------------------------------------------------------------------------------------------------------------------------------------------------
28|DS3|EU |ITEM-232 |0101250300225300 |0101250300225399 | 100|Phenny |
29|DS3|EU |ITEM-324 |0600528600210200 |0600528600210399 | 200|Phenny |

Required result after removing unnecessary space

Result


ABCDEFG
1DateSH_IDOrder NoQuantityDenominationFrom To
220-May-20TA5 A25/CP/0123/00333100ITEM-23201012503002251000101250300225199
320-May-20TA5 A25/CP/0123/00333200ITEM-32406005286002100000600528600210199
420-May-20TA5 A25/CP/0123/0033330ITEM-5240005084901091890 0005084901091919
520-May-20TA9A32/CP/0152/00352100ITEM-23201012503002252000101250300225299
620-May-20TA2A33/CP/0192/00395100ITEM-23201012503002253000101250300225399
720-May-20TA2A33/CP/0192/00395200ITEM-32406005286002102000600528600210399


Excel tables to the web >> Excel Jeanie HTML 4
 
Thanks for your reply
I have not checked it yet but my question is that if following line next row is DS4 or DS5 or DS6 then won't it work ?
RX.Pattern = "(DS3\|.*?\|)([^\|]+?)(\|)([^\|]+)(\|)([^\|]+)(\|)([^\|]+)(\|)"
 
Upvote 0

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
I have checked now and when I changed DS3 into DS4, code has not copied data of DS4
I would like to say that this line can be different
Maybe be start with DS or UF or QT
 
Upvote 0
I would like to say that this line can be different
Maybe be start with DS or UF or QT
All your examples had DS3, that's why I used that. ;)

Each cell contains many lines of data. We need some way to identify which lines have the data that we want to extract. So what is that identification?
  • Could it be that all the relevant lines have "EU" as the 'Type'?
  • Could it be that all the relevant lines contain the text "Item- ..." under 'Denomination'?
  • Could it be that all the relevant lines have "Decent" as the Salesman?
  • Could it be that all the 'From' and 'To' values are 16 digits
  • Could it be something else?

Could we have another set of sample data and expected results with XL2BB that shows more of the variation of data/results?
 
Upvote 1
Solution

Similar threads

Forum statistics

Threads
1,214,947
Messages
6,122,413
Members
449,082
Latest member
tish101

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