Match Number, then Find a string and extract the data between the brackets.

gsdanger

Board Regular
Joined
Jul 12, 2010
Messages
83
Office Version
  1. 2019
Platform
  1. Windows
Good Day all,:)

I have a spreadsheet that contains various types of data in it (see attached image).
Each piece of data equates to a number listing (1,2,3,etc...).
In the data area, I want to find the string FS, and extract the contents between the following brackets (xxx).
The number of rows within each number block can vary in numbers, so I guess the Find option will locate the relevant data to be
extracted.
Please help me with this, as I am going crazy trying to figure out how to do this.

King Regards....gsdanger...😢
 

Attachments

  • Chaos.png
    Chaos.png
    18.5 KB · Views: 19

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Difficult to extract your data from a picture. Would be better if you used XL2BB. In any event

Book4
FGHIJ
3NUMBERDATANUMBERDATA
41xxxxxxxxxxxxxxxxxx1-10
5xxxxxxxxxxxxxxxxxx23.5
6xxxxxxxxxxxxxxxxxx30
7XXXXXXFS(-10)412
82xxxxxxxxxxxxxxxxxx
9xxxxxxxxxxxxxxxxxx
10xxxxxxxxxxxxxxxxxx
11xxxxxxxxxxxxxxxxxx
12xxxxxxxxxxxxxxxxxx
13XXXXXXFS(3.5)
143xxxxxxxxxxxxxxxxxx
15xxxxxxxxxxxxxxxxxx
16XXXXXXFS(0)
174xxxxxxxxxxxxxxxxxx
18xxxxxxxxxxxxxxxxxx
19xxxxxxxxxxxxxxxxxx
20xxxxxxxxxxxxxxxxxx
21xxxxxxxxxxxxxxxxxx
22xxxxxxxxxxxxxxxxxx
23xxxxxxxxxxxxxxxxxx
24XXXXXXFS( 12)
Sheet1


With Power Query

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Filled Down" = Table.FillDown(Source,{"NUMBER"}),
    #"Extracted Text Between Delimiters" = Table.TransformColumns(#"Filled Down", {{"DATA", each Text.BetweenDelimiters(_, "FS(", ")"), type text}}),
    #"Filtered Rows" = Table.SelectRows(#"Extracted Text Between Delimiters", each ([DATA] <> ""))
in
    #"Filtered Rows"
 
Upvote 0
Hi alansidman,
Thanks for your prompt response.
I tried using XL2BB, however couldn't get it to work properly.
I'm a complete novice using the power query option.
Was looking for a solution using vba.
However, will try to understand the power query option.
Once again, thank you for your solution.

Regards..gsdanger😊
 
Upvote 0
Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

- Follow this link to learn how to install Power Query in Excel 2010 / 2013.

- Follow this link for an introduction to Power Query functionality.

- Follow this link for a video which demonstrates how to use Power Query code provided.
 
Upvote 0
I tried using XL2BB, however couldn't get it to work properly.
See if this helps, otherwise please explain just what goes wrong.

Was looking for a solution using vba.
Would you consider a formula solution?

23 09 18.xlsm
CDHI
1NUMBERDATA
21xxxxxxxxxxxxxxxxxx
3xxxxxxxxxxxxxxxxxx
4xxxxxxxxxxxxxxxxxx
5XXXXXXFS(-10)
62xxxxxxxxxxxxxxxxxx
7xxxxxxxxxxxxxxxxxx
8xxxxxxxxxxxxxxxxxx
9xxxxxxxxxxxxxxxxxx
10xxxxxxxxxxxxxxxxxx
111-10XXXXXXFS(3.5)
1223.53xxxxxxxxxxxxxxxxxx
1330xxxxxxxxxxxxxxxxxx
14412XXXXXXFS(0)
154xxxxxxxxxxxxxxxxxx
16xxxxxxxxxxxxxxxxxx
17xxxxxxxxxxxxxxxxxx
18xxxxxxxxxxxxxxxxxx
19xxxxxxxxxxxxxxxxxx
20xxxxxxxxxxxxxxxxxx
21xxxxxxxxxxxxxxxxxx
22XXXXXXFS( 12)
Extract values
Cell Formulas
RangeFormula
D11:D14D11=RIGHT(SUBSTITUTE(SUBSTITUTE(INDEX(INDEX(I:I,MATCH(C11,H:H,0)):I$22,MATCH("*FS(*",INDEX(I:I,MATCH(C11,H:H,0)):I$22,0)),"(",REPT(" ",20)),")",""),20)+0
 
Upvote 0
Solution
To alansidman and Peter SSs,
Thank you both for your responses.
alansidman,
I have looked at the links you supplied regarding the Power Query option, and it looks pretty good. I will educate myself in regards to utilising this option.

Peter SSs,
Thanks for your formula solution. works fine...Thanks.
I'm having trouble understanding the formula content. I will disect each formula input, to try and understand how the formula actually works.
I would never have thought of using the substitute option!
However, it works fine and once again, thank you.

Kind Regards...gsdanger 🥹
 
Upvote 0
Calling Peter_SSs...
Hi Peter_SSs,
Further to the solution you gave me a few weeks ago.
The solution works fine. Thanks for that.
However, there are a few modifications to the original example that renders your solution as not working.
Everything is the same, except for the following. The data in column I extends for 2000 rows, and the string I want to extract is NOT to the right of the data, as after the string I want to extract, there is more data, so I guess the Right function is irrelevant. Maybe the MID function can be used?
Can you please see if you can assist me with this modification?

Kind Regards...GSDANGER.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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