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. [TABLE="width: 372"]
<tbody>[TR]
[TD]



C&J ENERGY 1422213 NEAR $37.6 12/14/2018
[/TD]
[/TR]
[TR]
[TD]PIONEER 1422215 THUMMJ $25 12/14/2018
[/TD]
[/TR]
</tbody>[/TABLE]
$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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
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
C&J ENERGY 1422213 NEAR $37.6 12/14/2018
PIONEER 1422215 THUMMJ $25 12/14/2018
$42/TN [Hold]
$37.60 [Hold]
C&J ENERGY 1422199 NEAR $84.80 12/14/2018

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

[TD="align: right"]$37.6[/TD]
[TD="align: right"]$37.60[/TD]

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

[TD="align: right"]$25[/TD]
[TD="align: right"]$25.00[/TD]

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

[TD="align: right"]$42[/TD]
[TD="align: right"]$42.00[/TD]

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

[TD="align: right"]$37.60[/TD]
[TD="align: right"]$37.60[/TD]

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

[TD="align: right"]$84.80[/TD]
[TD="align: right"]$84.80[/TD]

</tbody>
Sheet403

[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(SUBSTITUTE(MID(A1,FIND("$",A1),30),"/"," ")," ",REPT(" ",30)),30))[/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"]=LEFT(SUBSTITUTE(SUBSTITUTE(MID(A1,FIND("$",A1),30),"/"," ")," ",REPT(" ",30)),30)+0[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

Works perfectly. Thanks!
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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