To find the position
of the First or Last Character\Type in a string use the following Array Formula
:
= [First or Last] (
CHOOSE( LOOKUP( CODE( UPPER(
MID( Cll , ROW( $A$1 : INDEX( $A:$A , LEN( Cll ) , 0 )), 1))),
[Lookup Array] ), "" ,
ROW( $A$1 : INDEX( $A:$A , LEN( Cll )))))
Where:
[First or Last]: Use MIN
for First Character or MAX
for Last Character
Cll: Cell containing the string to search
[Lookup Array]: Array to use for validation based on Type of Character to find
Type of Character - Classification (see Fig. 1)
Numeric: 0 to 9
Alpha: A to Z (lower & upper case)
Alpha International: Š Ž Ÿ À Á Â Ã Ä Å Ç È É Ê Ë Ì Í Î Ï Ñ Ò Ó Ô Õ Ö Ù Ú Û Ü Ý (lower & upper case)
Other Characters: Any other ASCII character
Fig. 1
Lookup Array to use for each Type of Character * - Short Array to be used with UPPER
function (see Fig. 2)
Numeric: {1,1;48,2;58,1}
Alpha: {1,1;65,2;91,1}
Alpha International: {1,1;138,2;139,1;142,2;143,1;159,2;160,1;192,2;
198,1;199,2;208,1;209,2;215,1;217,2;222,1}
Other Characters: {1,2;48,1;58,2;65,1;91,2;97,1;123,2;131,1;132,2;138,1;
139,2;142,1;143,2;154,1;155,2;156,1;157,2;158,1;160,2;192,1;
198,2;199,1;208,2;209,1;215,2;217,1;222,2;224,1;247,2;248,1}

Fig. 2
These arrays can be combined as needed, for example in this case the question asks to find the Last Alphanumeric character in the string, for that we'll use the Numeric and Alpha arrays combined.
String: VA4940--05-LAMB --,%2--
For this sample this string is located in cell C21
Let’s replace the arguments of the Array Formula:
[First or Last] => MAX
Cll => C21
[Lookup Array] => '{1,1;48,2;58,1;65,2;91,1}
- Alphanumeric
Enter the following Array Formula in cell G24
:
=MAX(CHOOSE(LOOKUP(
CODE(UPPER(MID($C21,ROW($A$1:INDEX($A:$A,LEN($C21),0)),1))),
{1,1;48,2;58,1;65,2;91,1}),"",
ROW($A$1:INDEX($A:$A,LEN($C21)))))
Basically what the formulas does is:
- Creates a vertical array assigning each character of the string into each row, the height of the array is automatically defined by the length of the string.
MID($C21,ROW($A$1:INDEX($A:$A,LEN($C21),0)),1))
Partial result: {V, A, 4, 9, 4, 0, -, -, 0, 5, -, L, A, M, B, , -, -, ,, %, 2, -, -}
- Validates the upper case ASCII Codes of the characters in each row of the vertical array against the Lookup Vector assigning 1 if failed or 2 if passed the validation.
LOOKUP(CODE(UPPER(
{V, A, 4, 9, 4, 0, -, -, 0, 5, -, L, A, M, B, , -, -, ,, %, 2, -, -}),
{1,1;48,2;58,1;65,2;91,1})
Partial result: {2,2,2,2,2,2,1,1,2,2,1,2,2,2,2,1,1,1,1,1,2,1,1}
- Fills up the array based on prior validation assigning the row number within the array (or position) to those who passed the validation and leaving blank the records that failed.
CHOOSE({2,2,2,2,2,2,1,1,2,2,1,2,2,2,2,1,1,1,1,1,2,1,1},"",
ROW($A$1:INDEX($A:$A,LEN($C21))))
Partial result: {1,2,3,4,5,6,,,9,10,,12,13,14,15,,,,,,21,,}
- Finally retrieves the
MAX
(as we’re looking for the last character) value in the array, representing the last valid row in the array complying with the Lookup Array condition.
MAX({1,2,3,4,5,6,,,9,10,,12,13,14,15,,,,,,21,,})
Position 21
See Fig. 3 with additional samples.

Fig. 3