How do I find the position of first number in a string in Google Sheets

Viewed 3126

I'm trying to find the position of the first number in a string (cell E4) in Google Sheets

I've tried:

=FINDB("\D+";E4)
=FINDB("[0-9]";E4)
=FINDB("[0-9]+";E4)

But none of these have worked

An example could be "I am 23 year old" then the position of the first number would be 6

Any ideas?

2 Answers

try it like this:

=FINDB(REGEXEXTRACT(A1; "\d"); A1)

0

You may also use REGEXEXTRACT with ^\D* pattern to extract all non-digit chars at the start of the string (if any, * means 0 or more occurrences) and then get the length of the resulting string to find the zero-based index of the digit char (or add 1 for a one-based index):

=LEN(REGEXEXTRACT(A1, "^\D*"))
=LEN(REGEXEXTRACT(A1, "^\D*"))+1

Test:

enter image description here

Related