"Ron Moore" wrote...
Another possible array formula (entered with CTRL-SHIFT-ENTER), for
data in A1:
=MAX(IF(ISNUMBER(--LEFT(A1,ROW($1:$50))),--LEFT(A1,ROW($1:$50))))
If necessary replace both occurrences of 50 with a sensible upper
limit for the string lengths you have.
....
There's not much gained using 50 rather than 1000 (or 10). Also, there's a
difference between locating the leftmost longest substring that could be
converted into a number and the leftmost longest substring of decimal
digits. Your formula returns errors when the first character is either a
dash or period followed by decimal digits.
As an alternative,
=--LEFT(A1,LOOKUP(1E300,-LEFT(A1,ROW($1:$50)),ROW($1:$50)))
which doesn't need to be entered as an array formula.
|