Extract a part of a string of data

datadummy

Active Member
Joined
Mar 16, 2017
Messages
313
Office Version
  1. 365
Platform
  1. Windows
I am wondering is it possible to write a formula that can extract a specific part of a string of data?
Example string: [TABLE="width: 370"]
<colgroup><col width="493" style="width: 370pt; mso-width-source: userset; mso-width-alt: 17521;"> <tbody>[TR]
[TD="width: 493, bgcolor: transparent"]ACETAMINOPHEN 300 MG-CODEINE 30 MG TABLET
For this one I would want to single out the 30 not necessarily concerned with the MG.

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

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
lots of conditions might need to be met for this to work since there are 2 numbers in string

1. Will it ALWAYS be after the "-" hyphen
2. Will there ALWAYS be an "MG" after the number you need
3. Is there ALWAYS another number prior to reaching the desired number
 
Upvote 0
This works on your sample, but may not work for other values.
=MID(SUBSTITUTE(G2," ",REPT(" ",200)),SEARCH(" MG ",SUBSTITUTE(G2," ",REPT(" ",200)))-300,200)*1
 
Upvote 0

Forum statistics

Threads
1,224,826
Messages
6,181,192
Members
453,021
Latest member
pingpong7117

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