# How To Find The First Number In A Text String

#### Tips & Tricks

In this post we’re going to find out how to get the position of the first number within a text string. Let’s suppose we have stock level data for a grocery store and in our example someone has gone and put both the item and stock quantity in one cell making it difficult to use the data. How can we easily separate this data into two cells?

Copy and paste this table into cell A1 in Excel

Item & Quantity Position Text To Left Text To Right
Pineapples260 =MIN(FIND({0,1,2,3,4,5,6,7,8,9},A2&”0123456789″)) =LEFT(A2,B2-1) =RIGHT(A2,LEN(A2)-B2+1)
Gala Apples20 =MIN(FIND({0,1,2,3,4,5,6,7,8,9},A3&”0123456789″)) =LEFT(A3,B3-1) =RIGHT(A3,LEN(A3)-B3+1)
Bananas6 =MIN(FIND({0,1,2,3,4,5,6,7,8,9},A4&”0123456789″)) =LEFT(A4,B4-1) =RIGHT(A4,LEN(A4)-B4+1)
Grape Bunch56 =MIN(FIND({0,1,2,3,4,5,6,7,8,9},A5&”0123456789″)) =LEFT(A5,B5-1) =RIGHT(A5,LEN(A5)-B5+1)

First to find the position of the first numeric character, we can use this formula.

``=MIN(FIND({0,1,2,3,4,5,6,7,8,9},A2&"0123456789"))``

This will find the position of the first instance of one of the elements of the array {0,1,2,3,4,5,6,7,8,9} (i.e. the first number) within cell A2 (our text data). The &”0123456789″ part ensures the FIND function will at least find a number if A2 does not actually have a number in it and will allow the formula to calculate without resulting in a #VALUE error.

We can then use this position we have just calculated to return the text to the left (the item) and the text to the right (the quantity).

Text to the left can be found with this formula.

``=LEFT(A2,B2-1)``

Text to the right can be found with this formula.

``=RIGHT(A2,LEN(A2)-B2+1)``

## John MacDougall

John is a Microsoft MVP and freelance consultant and trainer specializing in Excel, Power BI, Power Automate, Power Apps and SharePoint. You can find other interesting articles from John on his blog or YouTube channel.

## Related Articles

#### 37 Awesome Excel Mouse Tips & Tricks You Should Know

While the keyboard is generally quicker, you shouldn’t completely ignore the mouse. There are also some great time saving mouse shortcuts as well. In this post we’ll take a look at some of the best Excel mouse time saving tips and tricks.

#### 25 Amazing Power Query Tips and Tricks

Power query is amazing tool that allows you to import and transform data with ease and helps to create repeatable and robust procedures with your data. Here are some tips and tricks to help you get the most out Power Query.

#### Amazing Excel Tips and Tricks

A compilation of the best Excel tips and tricks ranging from beginner to pro that will save you time and make you more productive.

1. I tried cutting and pasting the example into Excel, and it didn’t work. I finally figured out the issue is that the font used here converted the quotation marks to characters that Excel didn’t recognize: ” ″. I changed them to ” and it worked fine.

• Yes, unfortunately WordPress and Excel use a different quote character.

2. Works great!