VBA – Extract Number From String

Extract Numerical Portion of String

The following function will extract the numerical portion from a string:

So for example:

Extract_Number_from_Text(“uuigguo 995”) will return 995
Extract_Number_from_Text(“uuigguo 0.12995”) will return 0.12995
Extract_Number_from_Text(“yu00.000456”) will return 0.000456
=Extract_Number_from_Text(“juii-0009.9987iihiii”) will return -0.9987
If there is no number in the phrase then a zero is returned.

To download the .XLSM file from this article, click here.

VBA Coding Made Easy

Stop searching for VBA code online. Learn more about Easy VBA. A VBA add-in to quickly insert any of the sample code found on our site directly into the Visual Basic Editor, save your own frequently used code, and more!

alt text

Stop searching for VBA code online. Try the Code VBA Add-in…

Learn More!

<<Return to VBA Examples

Did you find this VBA tutorial useful? Then share it with your friends and colleagues:

Leave A Comment