Question

I am trying to find a formula that will find the greatest numeric value in a column with strings of alphanumeric values. I want it to match the letters but find the greatest number within that match. E.g.

E
SW0044
MO0001
MO0002
MO0003
MO0004

So in Column 'E' I want to match the greatest MO number - which is MO0004 in this case. Is there anyway you can help?

Was it helpful?

Solution

There might be a more efficient way, but here is one solution. It does not have any error checking

Sample

Cell B1 is the input for what prefix you want.

Cell B2 contains an array formula: (ControlShiftEnter to enter formula)

=INDEX(B4:B10,MATCH(MAX(VALUE(IF(LEFT($B4:$B10,LEN($B$1))=$B$1,SUBSTITUTE(B4:B10,$B$1,""),0))),VALUE(IF(LEFT($B4:$B10,LEN($B$1))=$B$1,SUBSTITUTE(B4:B10,$B$1,""),0)),0))

EDIT Modified to allow for variable length prefix

Revised

OTHER TIPS

In F1 enter:

=LEFT(E1,2)

and copy down

In G1 enter:

=--RIGHT(E1,4)

and copy down

then use the array formula:

=MAX(IF(F1:F5="MO",G1:G5))

Array formulas must be entered with Ctrl + Shift + Enter rather than just the Enter key.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top