Extract Variable Text String

Abraxas365

New Member
Joined
Mar 22, 2019
Messages
4
Ok, I got a bunch of data rows with the following kind of data:

FACILITYID</td><td>H1676</td></
FACILITYID</td><td>PN1354</td>
FACILITYID</td><td>61523/54712</

... and so on.

I need to extract the unique data, no matter the length, from each cell. Unfortunately, a lot of characters like "<" are repeated, so I don't know how to tell Excel to stop at a certain "<" and give me an answer with a variable length that doesn't include any "<" or "/" (except in situations like the 3rd row, where I need the 10 digit number separated by "/".

All cells begin with "FACILITYID</td><td>" and then it's the number I want, and then it's junk for a couple of characters that I don't need.

Any help would be appreciated!
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Welcome to the Board...

Show us the expected extracted data results for each of the 2 given rows. I guess your data is all in Column A. If not tell us more...
 
Upvote 0
Hi,

Based on your 3 samples and written description, try these, either B1 or C1 formula copied down:


Book1
ABC
1FACILITYIDH1676H1676H1676
2FACILITYIDPN1354PN1354PN1354
3FACILITYID61523/54712</</td>61523/5471261523/54712
Sheet641
Cell Formulas
RangeFormula
B1=TRIM(LEFT(SUBSTITUTE(MID(A1,20,99),"<",REPT(" ",99)),99))
C1=TRIM(MID(SUBSTITUTE(A1,"<",REPT(" ",99),3),20,99))
 
Upvote 0
Hi,

Based on your 3 samples and written description, try these, either B1 or C1 formula copied down:

ABC
FACILITYID</td><td>H1676</td></H1676H1676
FACILITYID</td><td>PN1354</td>PN1354PN1354
FACILITYID</td><td>61523/54712</61523/5471261523/54712

<colgroup><col style="width: 25pxpx"><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]

[TD="align: center"]3[/TD]

</tbody>
Sheet641

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]B1[/TH]
[TD="align: left"]=TRIM(LEFT(SUBSTITUTE(MID(A1,20,99),"<",REPT(" ",99)),99))[/TD]
[/TR]
[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]C1[/TH]
[TD="align: left"]=TRIM(MID(SUBSTITUTE(A1,"<",REPT(" ",99),3),20,99))[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

I realized after I posted that some of the cell information was being translated (like code) and didn't know how to edit it. I was working on a reply to clear it up but you guys knew what I wanted anyway.

When I try this, all my results begin with "d>" but I changed 20 to 22 and it works.

Thanks so much!
 
Upvote 0
You're welcome, you must have 2 additional leading characters that I couldn't account for, but glad it works for you.

Welcome to the forum.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,249
Members
452,623
Latest member
Techenthusiast

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