pull numbers from text string. trim text

jacknc

Board Regular
Joined
Nov 28, 2005
Messages
75
Office Version
  1. 365
  2. 2019
My cell a96 contains "$82 Million Cash Value $51.4 Million"

I need b96 to show 82000000 which I can do using =VALUE(TRIM(LEFT(A69,LEN(A69)-33)))*1000000 I also need c96 to show 51400000

But feel that may present problem if if cash value is less than 33 characters

The numbers can change - but the text "Million Cash Value" and "Million" will always be there....

Any suggestions?
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
in C96

=VALUE(MID(A96, FIND("$",A96,FIND("$",A96)+1)+1,FIND(" ",A96,FIND("$",A96,FIND("$",A96)+1)+1)- FIND("$",A96,FIND("$",A96)+1)-1))*10^6
 
Upvote 0
Hi,

If the text "Million Cash Value" and "Million" will always be there....

To find 82 B96 =LEFT(RIGHT(A96,LEN(A96)-1),FIND("Million Cash Value",A96)-2)*10^6

To find 51.4 C96
=SUBSTITUTE(MID(A96,FIND("Value",A96)+5,(FIND("Million",A96,FIND("Million",A96)+2))-(FIND("Value",A96)+5)),"$","")*10^6
 
Upvote 0
Last edited:
Upvote 0
Three characters shorter...
Code:
=SUBSTITUTE(MID(A96,FIND(" $",A96),99),"Million","")*10^6
Actually, this one is another 8 characters shorter yet, but it has the disadvantage of introducing a fourth function call. Of course, that may not be an actual disadvantage because I am not sure how a LEFT and LEN functions compare efficiency-wise to the SUBSTITUTE function that was replaced by them.

=MID(LEFT(A96,LEN(A96)-7),FIND(" $",A96),99)*10^6
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,592
Members
449,089
Latest member
Motoracer88

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