How to extract numbers from a string of text in Excel

While Excel provides a wide range of functions and tools, we’ve come to find it does not house a number extraction tool. It instead houses something better. A tool with which we may construct our own number extraction tool. 


  1. Go to file > options > customize ribbon 
  2. Check the developer box 
  3. Select OK 
  4. Go to developer > visual basic 
  5. Right click your sheet 
  6. Select insert > module 
  7. Input script 

If you’d like to get started: you will find a step-by-step guide featuring images to provide additional support. However, before starting, we recommend you keep this script open in a separate tab — you will want to use it later on. 

Quick links: 

Number stripping string of text in Excel 

Step 1 – Open the file tab from the ribbon 

  • At the top of the window, you should see the File tab at the leftmost portion of the ribbon. Click it to continue. 

Step 2 – Access Excel’s options 

  • At the bottom of the side panel, you’ll notice an Options link. Select it to proceed. 

Step 3 – Enable the developer tab for the ribbon 

  • From the Excel Options menu, navigate to Customize Ribbon. You will be met by two scrollable boxes. Traverse the right box until you spot the Developer option. Ensure it is checked before clicking OK

Step 4 – Open the Visual Basic window via the development tab 

  • You should now be able to see the Developer tab at the end of your ribbon. Access it and open Visual Basic from its toolbar. 

Step 5 – Insert a VB module into your sheet 

  • In the new window, locate your sheet on the left side panel. Right click your sheet and select insert followed by module

Step 6 – Input the provided VB script 

  • Remember that script we told you to keep on hand? If not, you’d best get scrolling. You’ll need to paste it into the new window (after which you can close it). 

Step 7 – Use your newly created function 

  • Now our module is added, you can click an empty cell and input the function =GetNumeric(cell). Albeit, you’d need to replace cell with an actual cell containing numbers and strings of course. 

End note 


While Excel does not offer a default number extraction function, it instead offers us the ability to create our own. This is powered by Visual Basic modules that interact with our sheets. As a result of this, we may input scripts (like the one provided) to import additional functionality into Excel. Thus, making it possible to extract numbers from a string, in just a single function- or so much more. 


As usual, this section is dedicated to thanking readers for their support. We’d be pleased to know you found this post useful and/or informative. If you have any more Office 365 related queries, please consult our related articles (listed below). However, if you have other queries, consider looking at the rest of the site. We’re frequently posting new stuff each week and may just have the guide or troubleshooting tips you need. Regardless, we wish you a good day/night. Farewell readers. 

Our related articles: 

  • A complete guide to using OneDrive to transfer files to a new computer – OneDrive is a cloud storage platform offered as part of the Microsoft 365 suite. With it, your various folders and files may be stored online and downloaded for use from anywhere with an internet connection. As such, OneDrive is very useful if you’re looking to get files from one computer to another without wanting to mess around with storage devices. 
  • A complete guide to fixing OneDrive sync issues on Mac – OneDrive sometimes has issues, and many users have claimed that OneDrive isn’t synchronizing on their Mac OS devices, however, there are solutions available. In this blog, we will cover the most effective approaches to help users fix sync issues on their OneDrive devices. We will address some of the causes of why OneDrive won’t sync correctly and what users can do to help resolve these issues. Use the guide below to see how you can resolve OneDrive sync issues on Mac OS devices. 
  • Ways to delete a OneDrive shared library – OneDrive’s Shared libraries (or SharePoint sites) serve as large collections of various documents, media and content for your team/organization. In this post we’ll be giving you a short image guided walk through on deleting your OneDrive shared libraries. Additionally, to ease any potential confusion, we’ll also go over why you may still be seeing your shared library afterwards. 
  • Guide to deleting document libraries in SharePoint Online – SharePoint Online uses document libraries to store various files and folders created by you (the user). If a user for some reason decided they no longer required a document library, they could exercise the ability to delete it. Albeit, that requires actually knowing how to go about it. Fortunately for us, it’s quite straightforward. In this short post we’ll be guiding you through deleting document libraries with an image assisted walkthrough. We’ll additionally let you know why you may be unable to delete a certain library and under what circumstances your lost data can be restored. 

Jack Mitchell

Jack Mitchell has been the Operations manager at telecoms and MSP Optionbox for more than 4 years. He has played a crucial role in the company, from marketing to helpdesk, and ensures that the IT requirements of over 300 clients are continuously met. With his innate passion for technology and troubleshooting and a particular interest in Apple products, Jack now delivers the most comprehensive tech guides to make your life easier. You can connect with Jack on LinkedIn.

Recent Posts