Solved

Determine the position of the first of any of the ten primary digits in an Excel text entry

Posted on 2014-01-06
4
204 Views
Last Modified: 2014-01-21
Hello,

Does Excel (2013) have a command which will search for the position of the first number or digit in a string of text?

The command =SEARCH() will return the position of the first specified character or sequence of characters in a given cell. However, suppose you want to determine the position of the first of any of the ten primary digits (ie 0, 1, 2, 3...9) in a cell. Is there a way to do that?

For example, such a command would return the following results:

5 — for a cell containing "mT  z7DL2x Y"
8 — for a cell containing "g DqQj 3vd2AEp"
2 — for a cell containing "y4tKgu"
6 — for a cell containing "tq  k8w3a4"

and so on.

Thanks
0
Comment
Question by:Steve_Brady
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 54

Assisted Solution

by:Joe Winograd, EE MVE
Joe Winograd, EE MVE earned 200 total points
ID: 39759771
Hi Steve,

This article has your answer. Note specifically the section that says this (the previous sections are important, too):

Determine the position of the number in the alphanumeric string

Now we determine the position of the number by locating a TRUE value in the result of the decomposed string mentioned in the paragraph above. We employ the MATCH function here. The revised formula now becomes:

=MATCH(TRUE,ISNUMBER(1*MID(A1,ROW($1:$9),1)),0)

Important: You must enter this formula as an array by pressing CTRL+SHIFT+ENTER. If the string is abc123, this formula will yield 4 — that being the position of the first numeric character in the alphanumeric string.

There's more in the article after that, but this is where you can stop. :)   Regards, Joe
0
 
LVL 50

Accepted Solution

by:
barry houdini earned 300 total points
ID: 39760014
Hello Steve, try this non-array version to find the position of the first digit in A1

=MOD(MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&1234567890)),LEN(A1)+1)

by concatenating all the digits to A1 in FIND it avoids errors. The MOD part ensures that you get zero if there are no numbers in A1

....or alternatively you can use AGGREGATE function like this

=IFERROR(AGGREGATE(15,6,FIND({1,2,3,4,5,6,7,8,9,0},A1),1),0)

In AGGREGATE, 15 denotes SMALL function and 6 means that errors generated by FIND are ignored

regards, barry
0
 

Author Closing Comment

by:Steve_Brady
ID: 39798163
Thanks
0
 
LVL 54

Expert Comment

by:Joe Winograd, EE MVE
ID: 39798376
You're welcome.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question