Extract Numbers from Text String

Dastnai

New Member
Joined
Oct 26, 2018
Messages
45
Hi Everyone, I am looking to extract numbers from text strings. I appreciate your help.




C&J ENERGY 1422213 NEAR $37.6 12/14/2018
PIONEER 1422215 THUMMJ $25 12/14/2018

<tbody>
</tbody>
$42/TN [Hold]
$37.60 [Hold]
C&J ENERGY 1422199 NEAR $84.80 12/14/2018

Desired outcome:
$37.6
$25
$42
$37.60
$84.80

Regards,

Dastnai
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Assuming data in B2
Somewhere put =MID(B2,FIND("$",B2,1),FIND(" ",B2,FIND("$",B2,1))-FIND("$",B2,1))
 
Upvote 0
Hi,

Based on your samples, use one of the following.

B1 formula results as Text (extracts the $ value exactly as shown).
C1 formula Converts results to Real numbers for further math/comparison, Format result cells as Currency.

Either formula copied down.


Book1
ABC
1C&J ENERGY 1422213 NEAR $37.6 12/14/2018$37.6$37.60
2PIONEER 1422215 THUMMJ $25 12/14/2018$25$25.00
3$42/TN [Hold]$42$42.00
4$37.60 [Hold]$37.60$37.60
5C&J ENERGY 1422199 NEAR $84.80 12/14/2018$84.80$84.80
Sheet403
Cell Formulas
RangeFormula
B1=TRIM(LEFT(SUBSTITUTE(SUBSTITUTE(MID(A1,FIND("$",A1),30),"/"," ")," ",REPT(" ",30)),30))
C1=LEFT(SUBSTITUTE(SUBSTITUTE(MID(A1,FIND("$",A1),30),"/"," ")," ",REPT(" ",30)),30)+0
 
Upvote 0
Hi,

Based on your samples, use one of the following.

B1 formula results as Text (extracts the $ value exactly as shown).
C1 formula Converts results to Real numbers for further math/comparison, Format result cells as Currency.

Either formula copied down.

ABC
1C&J ENERGY 1422213 NEAR $37.6 12/14/2018$37.6$37.60
2PIONEER 1422215 THUMMJ $25 12/14/2018$25$25.00
3$42/TN [Hold]$42$42.00
4$37.60 [Hold]$37.60$37.60
5C&J ENERGY 1422199 NEAR $84.80 12/14/2018$84.80$84.80

<colgroup><col style="width: 25pxpx"><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet403

Worksheet Formulas
CellFormula
B1=TRIM(LEFT(SUBSTITUTE(SUBSTITUTE(MID(A1,FIND("$",A1),30),"/"," ")," ",REPT(" ",30)),30))
C1=LEFT(SUBSTITUTE(SUBSTITUTE(MID(A1,FIND("$",A1),30),"/"," ")," ",REPT(" ",30)),30)+0

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Works perfectly. Thanks!
 
Upvote 0

Forum statistics

Threads
1,215,056
Messages
6,122,907
Members
449,096
Latest member
dbomb1414

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