Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
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
Medium Priority
?
214 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 55

Assisted Solution

by:Joe Winograd, EE MVE 2015&2016
Joe Winograd, EE MVE 2015&2016 earned 800 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 1200 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 55

Expert Comment

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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
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…

705 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