Left trim: Remove characters after last instance of a number

For data in A1, in another cell, enter the array formula:

=LEFT(A1,MAX(IFERROR(FIND({1,2,3,4,5,6,7,8,9,0},A1,ROW(INDIRECT("1:"&LEN(A1)))),0)))

enter image description here

Array formulas must be entered with Ctrl + Shift + Enter rather than just the Enter key. If this is done correctly, the formula will appear with curly braces around it in the Formula Bar.


A UDF to do the same:

Function LNum(Target As Range) As String

Dim i As Long

For i = Target.Characters.Count To 1 Step -1
If IsNumeric(Target.Characters(i, 1).Text) Then GoTo MyExit
Next i
MyExit:
LNum = Left(Target, i)

End Function

enter image description here


I don't have excel installed, but same syntax seem to apply as in google sheets. Very simple regex should be easy to understand.

=REGEXEXTRACT(A1,".*\d")

Regex captures anything but must end with a digit.

enter image description here

Can anyone with Excel please verify syntax is the same?