Extract number with decimal from a text string cell

macjagger17

New Member
Joined
Jan 25, 2022
Messages
6
Office Version
  1. 2016
  2. 2013
  3. 2010
Platform
  1. Windows
Dear All,

Appreciate your assistance to my inquiry below. I wanted to extract the highlighted decimal number (put in Column B) from the text string cell (Column A) as below. Anyone can assist on the formula?


Source - text string cell in Column A
1/11/21 960 C P GL 71,959.26 71,959.26 CR
24/01/22 10 D A CC 10.90 348.46 CR
2/12/21 60 C A CC 70,076.00 320.50 DR
24/01/22 10 D A CC 417.50 1,445.46 DR
1/11/21 960 C P GL 71,959.26 1,143,461.42 CR

The decimal numbers I want in Column B

71,959.26​
348.46​
320.50​
1,445.46​
1,143,461.42​

1643101433076.png
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Try text to columns - use space as delimiter and in the last windows select all columns you do not want to import
 
Upvote 0
Try text to columns - use space as delimiter and in the last windows select all columns you do not want to import

OMG. thank you so much, arthurbr!!! really saved a lot of time than wasting my time to copy out and paste the number! btw is there any kind of formula to do like text to columns?

 
Upvote 0
With a non-US version one possibility
Excel Formula:
=TRIM(SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(A1;" ";REPT(" ";50);6);20));{"CR"\"DR"};" "))+0
For US versions replace the semi-colon with a comma and the backslash also with a comma ( I think)
There should be shorter versions, though
 
Upvote 0
Solution
With a non-US version one possibility
Excel Formula:
=TRIM(SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(A1;" ";REPT(" ";50);6);20));{"CR"\"DR"};" "))+0
For US versions replace the semi-colon with a comma and the backslash also with a comma ( I think)
There should be shorter versions, though
Thank you so muchhh, arthurbr! really appreciates it!
 
Upvote 0
Hi,

Just wanted to point out SUBSTITUTE can't handle arrays in that way, they must be done separately, here's a corrected version plus my suggestion:

Book3.xlsx
ABCD
1jtakwPost #4 correctedFrom Post #4
21/11/21 960 C P GL 71,959.26 71,959.26 CR71959.2671959.2671959.26
324/01/22 10 D A CC 10.90 348.46 CR348.46348.46348.46
42/12/21 60 C A CC 70,076.00 320.50 DR320.5320.5#VALUE!
524/01/22 10 D A CC 417.50 1,445.46 DR1445.461445.46#VALUE!
61/11/21 960 C P GL 71,959.26 1,143,461.42 CR1143461.421143461.421143461.42
Sheet944
Cell Formulas
RangeFormula
B2:B6B2=MID(SUBSTITUTE(A2," ",REPT(" ",100)),600,100)+0
C2:C6C2=SUBSTITUTE(SUBSTITUTE(RIGHT(SUBSTITUTE(A2," ",REPT(" ",50),6),20),"CR",""),"DR","")+0
D2:D6D2=TRIM(SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",50),6),20)),{"CR","DR"}," "))+0
 
Upvote 0
Hi,

Just wanted to point out SUBSTITUTE can't handle arrays in that way, they must be done separately, here's a corrected version plus my suggestion:

Book3.xlsx
ABCD
1jtakwPost #4 correctedFrom Post #4
21/11/21 960 C P GL 71,959.26 71,959.26 CR71959.2671959.2671959.26
324/01/22 10 D A CC 10.90 348.46 CR348.46348.46348.46
42/12/21 60 C A CC 70,076.00 320.50 DR320.5320.5#VALUE!
524/01/22 10 D A CC 417.50 1,445.46 DR1445.461445.46#VALUE!
61/11/21 960 C P GL 71,959.26 1,143,461.42 CR1143461.421143461.421143461.42
Sheet944
Cell Formulas
RangeFormula
B2:B6B2=MID(SUBSTITUTE(A2," ",REPT(" ",100)),600,100)+0
C2:C6C2=SUBSTITUTE(SUBSTITUTE(RIGHT(SUBSTITUTE(A2," ",REPT(" ",50),6),20),"CR",""),"DR","")+0
D2:D6D2=TRIM(SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",50),6),20)),{"CR","DR"}," "))+0

Hi jtakw, thank you so much for your help! Really works great! I can use your formula in Column B & C for my excel!
 
Upvote 0

Forum statistics

Threads
1,224,816
Messages
6,181,141
Members
453,021
Latest member
Justyna P

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