Extract data from stings and organise Help needed.

Martynrbell

New Member
Joined
Apr 11, 2016
Messages
38
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I require some extracting and correlating data.


In my raw data i have a PA1 followed by a PA6
[TABLE="width: 245"]
<tbody>[TR]
[TD]
PA1*7*-1*Item one
PA6*81001234*Item one

I require the "7" and the "81001234" to be returned in specific places in a table so i can then do a look up against them.

One thing to note is the numbers are always between ** but are may not always by the same length in character.

an example of the raw data.

[TABLE="width: 500"]
<tbody>[TR]
[TD][TABLE="width: 245"]
<tbody>[TR]
[TD="class: xl65, width: 245"]PA1*7*-1*Item one[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 245"]
<tbody>[TR]
[TD="class: xl65, width: 245"]PA6*81001234*Item one[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 245"]
<tbody>[TR]
[TD="class: xl65, width: 245"]PA1*8*-1*Item two[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 245"]
<tbody>[TR]
[TD="class: xl65, width: 245"]PA6*81005678*Item two[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 245"]
<tbody>[TR]
[TD="class: xl65, width: 245"]PA1*9*-1*Item three[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 245"]
<tbody>[TR]
[TD="class: xl65, width: 245"]PA6*81009101*Item three[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 245"]
<tbody>[TR]
[TD="class: xl65, width: 245"]PA1*10*-1*Item four[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 245"]
<tbody>[TR]
[TD="class: xl65, width: 245"]PA6*81001112*Item four[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 245"]
<tbody>[TR]
[TD="class: xl65, width: 245"]PA1*11*-1*Item five[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 245"]
<tbody>[TR]
[TD="class: xl65, width: 245"]PA6*81001213*Item five[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD]PA1*12*-1*Item six[/TD]
[/TR]
[TR]
[TD][TABLE="width: 245"]
<tbody>[TR]
[TD="class: xl65"]PA6*81001314*Item six[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 245"]
<tbody>[TR]
[TD="class: xl65"]PA1*13*-1*Item seven[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 245"]
<tbody>[TR]
[TD="class: xl65"]PA6*81001516*Item seven[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]



The returned result


[TABLE="width: 250"]
<tbody>[TR]
[TD]7[/TD]
[TD]81001234[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65, width: 64, align: right"]81005678[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65, width: 64, align: right"]81009101[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65, width: 64, align: right"]81001112[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65, width: 64, align: right"]81001213[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65, width: 64, align: right"]81001314[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD][TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65, width: 64, align: right"]81001516[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]



Any and all help would be appreciated.

Thanks

Martyn[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Data without the boxes[TABLE="width: 245"]
<colgroup><col></colgroup><tbody>[TR]
[TD]

PA1*7*-1*Item one[/TD]
[/TR]
[TR]
[TD]PA6*81001234*Item one[/TD]
[/TR]
[TR]
[TD]PA1*8*-1*Item two[/TD]
[/TR]
[TR]
[TD]PA6*81005678*Item two[/TD]
[/TR]
[TR]
[TD]PA1*9*-1*Item three[/TD]
[/TR]
[TR]
[TD]PA6*81009101*Item three[/TD]
[/TR]
[TR]
[TD]PA1*10*-1*Item four[/TD]
[/TR]
[TR]
[TD]PA6*81001112*Item four[/TD]
[/TR]
[TR]
[TD]PA1*11*-1*Item five[/TD]
[/TR]
[TR]
[TD]PA6*81001213*Item five[/TD]
[/TR]
[TR]
[TD]PA1*12*-1*Item six[/TD]
[/TR]
[TR]
[TD]PA6*81001314*Item six[/TD]
[/TR]
[TR]
[TD]PA1*13*-1*Item seven[/TD]
[/TR]
[TR]
[TD]PA6*81001516*Item seven

Returned result

7 81001234
8 81005678
9 81009101
10 81001112
11 81001213
12 81001314
13 81001516



[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Hi,

Would something like this help:


Book1
AB
1PA1*7*-1*Item one7 81001234
2PA6*81001234*Item one
3PA1*8*-1*Item two8 81005678
4PA6*81005678*Item two
5PA1*9*-1*Item three9 81009101
6PA6*81009101*Item three
7PA1*10*-1*Item four10 81001112
8PA6*81001112*Item four
9PA1*11*-1*Item five11 81001213
10PA6*81001213*Item five
11PA1*12*-1*Item six12 81001314
12PA6*81001314*Item six
13PA1*13*-1*Item seven13 81001516
14PA6*81001516*Item seven
Sheet80
Cell Formulas
RangeFormula
B1=IF(ISODD(ROW(A1)),TRIM(MID(SUBSTITUTE(A1,"*",REPT(" ",100)),100,100))&" "&TRIM(MID(SUBSTITUTE(A2,"*",REPT(" ",100)),100,100)),"")


Formula copied down.
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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