formula to extract numbers from text

Obewan

Board Regular
Joined
Aug 25, 2021
Messages
68
Office Version
  1. 365
Platform
  1. Windows
I want a formula to extract the % numbers from the text in column B - data below is from column A. Answer can just be a number or % format. For example answer for the first one would = 4.02%. Thanks in advance!!

Staff costs
$4.02% staff costs
$73.31% staff costs
$60.60% staff costs
$59.94% staff costs
$74.16% staff costs
$11.47% staff costs
$53.33% staff costs
$100.90% staff costs
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Maybe this:

Excel Formula:
=TEXTAFTER(TEXTBEFORE(A2," "),"$")
 
Upvote 0
Maybe this:

Excel Formula:
=TEXTAFTER(TEXTBEFORE(A2," "),"$")
Wow that was quick - looks good but still has the word staff in the answer - i.e. answer = 4.02% staff - can we get rid of the word staff as well?
 
Upvote 0
It would only have "staff" in the result if there is not a space between "%" and "s". The solution I provided requires "% s". If adding the space is not desired, then change the formula to this:

Excel Formula:
=TEXTAFTER(TEXTBEFORE(A2,"staff"),"$")
 
Upvote 1
Maybe this option will work
VBA Code:
=TEXTAFTER(TEXTBEFORE(A2," "),"$")

Edit: Just realized this is the same answer @dreid1011 posted initially!
 
Upvote 0
It would only have "staff" in the result if there is not a space between "%" and "s". The solution I provided requires "% s". If adding the space is not desired, then change the formula to this:

Excel Formula:
=TEXTAFTER(TEXTBEFORE(A2,"staff"),"$")
Champion!! Thanks a million!
 
Upvote 0
You're welcome, and happy to help.
One more thing - the answer is good but doesn't appear to be in the right format - how can I get it into a number or % format? Think it might be in text or something as I can't write any formulas to get the median or average?
 
Upvote 0
You could try adding a -- in front of the formula to convert it into a number.
 
Upvote 0

Forum statistics

Threads
1,223,244
Messages
6,170,976
Members
452,372
Latest member
Natalie18

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