Extract data after special characters

maayub

New Member
Joined
Apr 15, 2018
Messages
8
I want to extract data from a cell containing this information:

G# 202352, 202347 ZRX MED 4984 LT/PIR WE 218867 DUE 4/30

G#222237/222240/222244 TUE 4911/4913/4940 PI/CFZ WE 220917 DUE 04/30
G# 202352,202347 ZRX MED 4984 LT/PIR WE 218867, 218357 DUE 4/30
G# 202352 ZRX MED 4984 LT/PIR WE 218867, 218357 DUE 9/14

1. I want to extract data after G#. This data is always 6 digits. This 6 digit data is sometimes in 1 set or up to 5 sets separated by a comma or /. See examples above.

2. I also want to extract the data after "WE". this data is also 6 digit long. Sometimes in 1 set or up to 5 sets.


I want both sets of data display in two different columns. How can I do that?

<tbody>
</tbody>

<tbody>
</tbody>
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Hi,

This will get it started, you didn't say how you want the results formatted, as the source data is not "uniform":


Excel 2010
ABCD
1G# 202352, 202347 ZRX MED 4984 LT/PIR WE 218867 DUE 4/30202352,202347218867
2G#222237/222240/222244 TUE 4911/4913/4940 PI/CFZ WE 220917 DUE 04/30222237/222240/222244220917
3G# 202352,202347 ZRX MED 4984 LT/PIR WE 218867, 218357 DUE 4/30202352,202347218867,218357
4G# 202352 ZRX MED 4984 LT/PIR WE 218867, 218357 DUE 9/14202352218867,218357
Sheet23
Cell Formulas
RangeFormula
C1=TRIM(LEFT(SUBSTITUTE(SUBSTITUTE(TRIM(MID(A1,3,255)),", ",",")," ",REPT(" ",100)),50))
D1=TRIM(LEFT(SUBSTITUTE(SUBSTITUTE(MID(A1,SEARCH("WE",A1)+3,255),", ",",")," ",REPT(" ",100)),50))


Formulas copied down.
 
Upvote 0
My apologies. I was not specific regarding this formula. I want to extract the 6 digit data after "G#" on each cell (if it exists) in cell B separating with a "comma space" and also want to extract the data after "WE " in cell C (if it exist) separating with a comma space. Please see the examples below:

ABC
1G# 202352, 202347 ZRX MED 4984 LT/PIR WE 218867 DUE 4/30202352, 202347218867
2Differ_GQQ02_02-10_IC_18-014_Due_12/25
3G#222237/222240/222244 TUE 4911/4913/4940 PI/CFZ WE 220917 DUE 04/30222237, 222240, 222244220917
4G# 202352,202347 ZRX MED 4984 LT/PIR WE 218867, 218357 DUE 4/30202352, 202347218867, 218357
52018 BS OCM WRT Carport -ZXR-94 VIFG54 *WATER* LO (JLK 2)
6G# 202352 ZRX MED 4984 LT/PIR WE 218867, 218357 DUE 9/14202352218867, 218357
<colgroup><col width="64" style="width: 48pt;"> <col width="581" style="width: 436pt; mso-width-source: userset; mso-width-alt: 21248;"> <col width="210" style="width: 158pt; mso-width-source: userset; mso-width-alt: 7680;"> <col width="186" style="width: 140pt; mso-width-source: userset; mso-width-alt: 6802;"> <tbody> </tbody>
 
Upvote 0
Hi,

For some reason, I wasn't notified you had replied above, just checked my own postings and saw your reply, see if this covers your different scenarios:


Excel 2010
ABC
1G# 202352, 202347 ZRX MED 4984 LT/PIR WE 218867 DUE 4/30202352, 202347218867
2G#222237/222240/222244 TUE 4911/4913/4940 PI/CFZ WE 220917 DUE 04/30222237, 222240, 222244220917
3G# 202352,202347 ZRX MED 4984 LT/PIR WE 218867, 218357 DUE 4/30202352, 202347218867, 218357
4G# 202352 ZRX MED 4984 LT/PIR WE 218867, 218357 DUE 9/14202352218867, 218357
5G# 202352, 202347 ZRX MED 4984 LT/PIR WE 218867 DUE 4/30202352, 202347218867
6Differ_GQQ02_02-10_IC_18-014_Due_12/25
7G#222237/222240/222244 TUE 4911/4913/4940 PI/CFZ WE 220917 DUE 04/30222237, 222240, 222244220917
8G# 202352,202347 ZRX MED 4984 LT/PIR WE 218867, 218357 DUE 4/30202352, 202347218867, 218357
92018 BS OCM WRT Carport -ZXR-94 VIFG54 *WATER* LO (JLK 2)
10G# 202352 ZRX MED 4984 LT/PIR WE 218867, 218357 DUE 9/14202352218867, 218357
11ZRX MED 4984 LT/PIR WE 218867, 218357 DUE 9/14218867, 218357
12G# 202352 ZRX MED 4984 LT/PIR202352
Sheet23
Cell Formulas
RangeFormula
B1=IF(ISNUMBER(SEARCH("G#",A1)),TRIM(LEFT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(TRIM(MID(A1,3,255)),", ",",")," ",REPT(" ",100)),",",", "),"/",", "),50)),"")
C1=IF(ISNUMBER(SEARCH("WE",A1)),TRIM(LEFT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(MID(A1,SEARCH("WE",A1)+3,255),", ",",")," ",REPT(" ",100)),",",", "),50)),"")
 
Upvote 0
Just a hair shorter for the first formula:


Excel 2010
ABC
1G# 202352, 202347 ZRX MED 4984 LT/PIR WE 218867 DUE 4/30202352, 202347218867
2G#222237/222240/222244 TUE 4911/4913/4940 PI/CFZ WE 220917 DUE 04/30222237, 222240, 222244220917
3G# 202352,202347 ZRX MED 4984 LT/PIR WE 218867, 218357 DUE 4/30202352, 202347218867, 218357
4G# 202352 ZRX MED 4984 LT/PIR WE 218867, 218357 DUE 9/14202352218867, 218357
5G# 202352, 202347 ZRX MED 4984 LT/PIR WE 218867 DUE 4/30202352, 202347218867
6Differ_GQQ02_02-10_IC_18-014_Due_12/25
7G#222237/222240/222244 TUE 4911/4913/4940 PI/CFZ WE 220917 DUE 04/30222237, 222240, 222244220917
8G# 202352,202347 ZRX MED 4984 LT/PIR WE 218867, 218357 DUE 4/30202352, 202347218867, 218357
92018 BS OCM WRT Carport -ZXR-94 VIFG54 *WATER* LO (JLK 2)
10G# 202352 ZRX MED 4984 LT/PIR WE 218867, 218357 DUE 9/14202352218867, 218357
11ZRX MED 4984 LT/PIR WE 218867, 218357 DUE 9/14218867, 218357
12G# 202352 ZRX MED 4984 LT/PIR202352
Sheet23
Cell Formulas
RangeFormula
B1=IF(LEFT(A1,2)="G#",TRIM(LEFT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(TRIM(MID(A1,3,255)),", ",",")," ",REPT(" ",100)),",",", "),"/",", "),50)),"")
C1=IF(ISNUMBER(SEARCH("WE",A1)),TRIM(LEFT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(MID(A1,SEARCH("WE",A1)+3,255),", ",",")," ",REPT(" ",100)),",",", "),50)),"")
 
Upvote 0
What does that mean?

Looks right to me in my samples.

it only returns extra set of G#'s with a "/" (examples above #2 and #7 ). Still returning single set of values with multiple G# separated with a comma. See below. Thanks.

ABC
1G# 202352, 202347 ZRX MED 4984 LT/PIR WE 218867 DUE 4/30202352218867
2G#2 22237/222240/222244 TUE 4911/4913/4940 PI/CFZ WE 220917 DUE 04/30222237, 222240, 222244220917
3G# 202352,202347 ZRX MED 4984 LT/PIR WE 218867, 218357 DUE 4/30202352218867, 218357
4G# 202352 ZRX MED 4984 LT/PIR WE 218867, 218357 DUE 9/14202352218867, 218357
5G# 202352, 202347 ZRX MED 4984 LT/PIR WE 218867 DUE 4/30202352218867
6Differ_GQQ02_02-10_IC_18-014_Due_12/25
7G#2 22237/222240/222244 TUE 4911/4913/4940 PI/CFZ WE 220917 DUE 04/30222237, 222240, 222244220917
8G# 202352,202347 ZRX MED 4984 LT/PIR WE 218867, 218357 DUE 4/30202352218867, 218357
92018 BS OCM WRT Carport -ZXR-94 VIFG54 *WATER* LO (JLK 2)
10G# 202352 ZRX MED 4984 LT/PIR WE 218867, 218357 DUE 9/14202352218867, 218357
11ZRX MED 4984 LT/PIR WE 218867, 218357 DUE 9/14218867, 218357
12G# 202352 ZRX MED 4984 LT/PIR202352

<thead>
</thead><tbody>
</tbody>
 
Upvote 0
I'm not clear on what you're saying.
Are you saying that some of your data Starts with G#2 and some with just G#?
If it starts with G#2, you want it ignored, or still extract the number strings?
What other possibilities are there, cause G#2 was never in your previous samples.
 
Upvote 0
No - when I posted my last message it just highlighted "G#2" for some reason. All I want is to extract the data starts with G# in column B and extract data after WE is column C (if G#'s and WE numbers are present in column A). The formula you provided in message #5 for column B is not giving me multiple sets of G values - it only extract the first set of values except when the 6 digit data is separated by a "/". When I enter the formula in column B it shows the data as shown in table 8. Hope this will clarify. the formula for column C is working fine. thank you.
 
Upvote 0

Forum statistics

Threads
1,216,074
Messages
6,128,653
Members
449,462
Latest member
Chislobog

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