Extract Data Query - Struggling

Carl Stephens

New Member
Joined
Jan 3, 2017
Messages
46
Office Version
  1. 365
Hello All,

I am looking for a formula that will extra the numbers after the last close parenthesis and before the currency code. Note, that the total number of digits can change (from 3 to 6), the currency code can change and there can sometimes be multiple close parentheses in the string, as in the last example below. Is there a formula that will extract this data? I have tried many that I know of and have failed, hence I am here. Thank you for your time.

String 1. "Ocean - Head Butler (4 months on/ 2 months off) 3675 USD"
String 2. "Ocean - Butler (4 months on/ 2 months off) 2800 GBP"
String 3. "Ocean - Chef de Partie - Pastry (Bonus) (4 months on/ 2 months off) 13360 USD"
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
That could be:
Mappe12
B
13675
Tabelle1
Cell Formulas
RangeFormula
B1B1=--TEXTBEFORE(TEXTAFTER(A1,"off) ")," ")
 
Upvote 0
@Carl Stephens : I changed the marked solution with the actual answer post to the question (post #5). In your future questions, please mark the post as the solution that actually answered your question, instead of your feedback message as it will help future readers. No further action is required for this thread.

--------

Also as another approach in Office 365: here are two different methods using different functions (new functions in 365) to extract data from a string like this - as it would also help future readers as an addition to @shift-del's solution above. Basically, we split the entire string using space as the delimiter with the TEXTSPLIT function, resulting in a two-dimensional array (a range in worksheet terms — one row, multiple columns in this example). From this array (range), we extract the required column using either the DROP/TAKE or CHOOSECOLS functions.

Book1
ABC
1StringAmount (DROP/TAKE)Amount (CHOOSECOLS)
2Ocean - Head Butler (4 months on/ 2 months off) 3675 USD36753675
3Ocean - Butler (4 months on/ 2 months off 2800 GBP28002800
4Ocean - Chef de Partie - Pastry (Bonus) (4 months on/ 2 months off) 13360 USD1336013360
Sheet1
Cell Formulas
RangeFormula
B2:B4B2=LET(arr, TEXTSPLIT(A2," "), cols, COLUMNS(arr), drop_curr, DROP(arr,,-1), amount, TAKE(drop_curr, ,-1), amount)
C2:C4C2=LET(arr, TEXTSPLIT(A2," "), cols, COLUMNS(arr), amount, CHOOSECOLS(arr,cols-1), amount)


Note about Office version I mentioned: I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
Solution
@Carl Stephens : I changed the marked solution with the actual answer post to the question (post #5). In your future questions, please mark the post as the solution that actually answered your question, instead of your feedback message as it will help future readers. No further action is required for this thread.

--------

Also as another approach in Office 365: here are two different methods using different functions (new functions in 365) to extract data from a string like this - as it would also help future readers as an addition to @shift-del's solution above. Basically, we split the entire string using space as the delimiter with the TEXTSPLIT function, resulting in a two-dimensional array (a range in worksheet terms — one row, multiple columns in this example). From this array (range), we extract the required column using either the DROP/TAKE or CHOOSECOLS functions.

Book1
ABC
1StringAmount (DROP/TAKE)Amount (CHOOSECOLS)
2Ocean - Head Butler (4 months on/ 2 months off) 3675 USD36753675
3Ocean - Butler (4 months on/ 2 months off 2800 GBP28002800
4Ocean - Chef de Partie - Pastry (Bonus) (4 months on/ 2 months off) 13360 USD1336013360
Sheet1
Cell Formulas
RangeFormula
B2:B4B2=LET(arr, TEXTSPLIT(A2," "), cols, COLUMNS(arr), drop_curr, DROP(arr,,-1), amount, TAKE(drop_curr, ,-1), amount)
C2:C4C2=LET(arr, TEXTSPLIT(A2," "), cols, COLUMNS(arr), amount, CHOOSECOLS(arr,cols-1), amount)


Note about Office version I mentioned: I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Thank you. I have updated my profile to show that I am using O365.

The below formula worked, only by default, it returns a text result rather than a number one, so I had to adjust it slightly by the second formula below, then it worked perfectly. Thank you so much for your support.
=LET(arr, TEXTSPLIT(A2," "),cols, COLUMNS(arr),amount, CHOOSECOLS(arr,cols-1),amount)
=LET(arr, TEXTSPLIT(A2," "),cols, COLUMNS(arr),amount, VALUE(CHOOSECOLS(arr,cols-1)),amount)
 
Upvote 0
Thank you. I have updated my profile to show that I am using O365.
Thanks for doing that!

The below formula worked, only by default, it returns a text result rather than a number one, so I had to adjust it slightly by the second formula below, then it worked perfectly. Thank you so much for your support.
=LET(arr, TEXTSPLIT(A2," "),cols, COLUMNS(arr),amount, CHOOSECOLS(arr,cols-1),amount)
=LET(arr, TEXTSPLIT(A2," "),cols, COLUMNS(arr),amount, VALUE(CHOOSECOLS(arr,cols-1)),amount)
Thanks for the feedback. Glad to hear it helped. These new functions are really useful ones.
 
Upvote 0

Forum statistics

Threads
1,223,889
Messages
6,175,226
Members
452,620
Latest member
dsubash

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