How to find position of first/last number in a text string in Excel?
For example, you have a list of text string which is a mixture of letters and numbers. If you want to find the position of the first or last number in each string, what would you do? Actually, using formula will help you quickly find the position of first/last number in a specified text string. In this tutorial, we will show you the details of dealing with this problem.
Find position of first number in text string in Excel
Find position of last number in text string in Excel
Find position of first number in text string in Excel
As the below screenshot shown, for finding positions of first numbers in the text strings, please do as follows.
1. Select the cell B2, copy and paste one of the below formula into the Formula Bar:
1). Formula 1: =MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A2&"0123456789"));
2). Formula 2: =MATCH(TRUE,ABS(CODE(MID(A2,ROW($A$1:INDEX(A:A,LEN(A2))),1))-52.5)<5,0) + Ctrl + Shift + Enter;
3). Formula 3: =MIN(IF(ISERROR(FIND({1;2;3;4;5;6;7;8;9;0},A2)),"",FIND({1;2;3;4;5;6;7;8;9;0},A2))).
2. Then the first number position of the first string is displaying in the cell B2. Now drag the Fill Handle down to cell B7 to fill the below range.
Then all first number positions of the whole strings are listed out.
Find position of last number in text string in Excel
After finding the position of first number, we now start finding the position of last number in strings.
In this section, there are two formulas for you.
Formula 1: =MAX(IF(ISNUMBER(VALUE(MID(A2,ROW(INDIRECT("1:" & LEN(A2))),1))),ROW(INDIRECT("1:" & LEN(A2))))) + Ctrl + Shift + Enter;
Formula 2: =MAX(IFERROR(FIND({1,2,3,4,5,6,7,8,9,0},A2,ROW(INDIRECT("1:"&LEN(A2)))),0)) + Ctrl + Shift + Enter
1. Select cell B2, copy and paste one of the above formulas into the Formula Bar, then press Ctrl + Shift + Enter keys simultaneously. Then you can see the result displays in B2.
2. Select the B2, drag the Fill Handle down to cell B7 to auto fill the range.
Then you will get positions of all last numbers of the whole text string immediately.
Easily separate text and number from one cell into two columns in Excel:
With Kutools for Excel’s Split Cells utility, you can split a range of cells into rows or columns by specific separator, split text and numbers or split text by certian length. Download and try it now! (30-day free trail)
Related articles:
- How to find first blank cells in column in Excel?
- How to find cells with/having conditional formatting in Excel?
- How to find cells with/having data validation in Excel?
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!















