Extract only numbers from cells with different lengths

Stuepef

Board Regular
Joined
Oct 23, 2017
Messages
128
Office Version
  1. 2021
Platform
  1. Windows
I have a worksheet with different values within column A and I am looking to extract all of the numbers only. The values in column A can vary in terms of length and characters (ie $, %, .). I understand my current formula is replacing all "-" with " ", but I am looking for assistance to refine it. Open to all suggestions/solutions.

Current formula:
Code:
=INT(LEFT(REPLACE(SUBSTITUTE(A6,"-"," "),1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A6&1/17))-1,""),5))

Workbook:
Code:
[TABLE="width: 412"]
<tbody>[TR]
[TD][/TD]
[TD]Formula[/TD]
[TD]Desired result[/TD]
[/TR]
[TR]
[TD]Ford $25-95%[/TD]
[TD]#VALUE![/TD]
[TD]25-95[/TD]
[/TR]
[TR]
[TD]Focus $1,000-$30[/TD]
[TD]1000[/TD]
[TD]1000-30[/TD]
[/TR]
[TR]
[TD]Honda $1,000-$45[/TD]
[TD]1000[/TD]
[TD]1000-45[/TD]
[/TR]
[TR]
[TD]LED Bright $2,000-100%[/TD]
[TD]2000[/TD]
[TD]2000-100[/TD]
[/TR]
[TR]
[TD]Best $2,000-70% Quarter back[/TD]
[TD]2000[/TD]
[TD]2000-70[/TD]
[/TR]
[TR]
[TD]HIU Book $2,500-100% Ge Plus[/TD]
[TD]2500[/TD]
[TD]2500-100[/TD]
[/TR]
[TR]
[TD]USA Emboss. green $3,000-80%[/TD]
[TD]3000[/TD]
[TD]3000-80[/TD]
[/TR]
[TR]
[TD]USA Emboss. Green $4,000-100%[/TD]
[TD]4000[/TD]
[TD]4000-100[/TD]
[/TR]
[TR]
[TD]Masters Gold $300[/TD]
[TD]300[/TD]
[TD]300[/TD]
[/TR]
[TR]
[TD]Masters Gold $750[/TD]
[TD]750[/TD]
[TD]750[/TD]
[/TR]
[TR]
[TD]UK 2500-55-30% Orange[/TD]
[TD]2500[/TD]
[TD]2500-55-30[/TD]
[/TR]
[TR]
[TD]F.ACE.500.80.40[/TD]
[TD]500[/TD]
[TD]500.80.40[/TD]
[/TR]
[TR]
[TD]F.ACE.1000.80.40[/TD]
[TD]1000[/TD]
[TD]1000.80.40[/TD]
[/TR]
[TR]
[TD]F.Ace.1500.60.75[/TD]
[TD]1500[/TD]
[TD]1500.60.75[/TD]
[/TR]
[TR]
[TD]F.ACE.1500.100.25[/TD]
[TD]1500[/TD]
[TD]1500.100.25[/TD]
[/TR]
</tbody>[/TABLE]

I appreciate your help!
 
Thank you for the replies! Unfortunately I wont be able to incorporate any VBA into this particular workbook though it would be awesome to do so. There are variable inputs in column A and it wont maintain the same format throughout.

The above code is a function, you can have different versions in different cells. Or change it to a macro/sub that can vary the output patterns.
 
Upvote 0

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
I guess I am unfamiliar with how functions work in excel?
 
Upvote 0
I guess I am unfamiliar with how functions work in excel?

Like a formula, you can write to whichever cells you want. More importantly, you can change the underlying code and choose which of the numbers will be returned.
 
Last edited:
Upvote 0
There are variable inputs in column A and it wont maintain the same format throughout.
Not sure just what you mean by that, but another formula suggestion for post #7 data is

Excel Workbook
AB
1ProductDesired Result
2Pontiac $500-$2020
3Feet $500-$4040
4USA Feet $2,000-100%100
5USA Feet $2,000-100% Gt Plus100
6Orange $3,000-70% Treat ACE Free70
7USA Emboss. Orange $3,000-80%80
8USA Emboss. Orange $4,000-100%100
9USA Emboss. Orange $4,000-100% Gt Plus100
Extract Number
 
Upvote 0

Forum statistics

Threads
1,223,907
Messages
6,175,301
Members
452,633
Latest member
DougMo

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