Looking for Max of a range of numbers in strings

twl2009

Board Regular
Joined
Jan 7, 2016
Messages
247
I am trying to get the highest number from a range of order no. that all start with 2 letters,Eg 'EC1189' etc.
I can strip the number from a cell easily with


Value(right(H6,4))


And can get the maximum from a small range with

max
(Value(right(H6,4)),Value(right(H7,4)),
Value(right(H8,4)))


But I cant figure out how to get maximum from a range, I have tried

max(Value(right(H6:H20,4)))
and
max(Value(right(H6:H,4)))
and
max(Value(right(H6,4)):Value(right(H20,4)))

and a few other variations, but nothing is working.

Any help very gratefully received

Twl

 
Last edited:

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Note the formula in I6 is an array formula. Confirmed with ctrl+shift+enter. Assumes the numeric part of the strings are always 4 digits.

Excel Workbook
HI
6EC12021209
7EC1198
8EC1190
9EC1200
10EC1209
11EC1197
12EC1199
13EC1201
14EC1194
15EC1193
16EC1195
17EC1191
18EC1196
19EC1192
20EC1189
Enter Data Here
 
Upvote 0
Thanks Joe, thats has sorted it. Is it possible to add an if component so that it only includes orders that start with 'EC' and ignores all others?

twl
 
Upvote 0
Thanks Joe, thats has sorted it. Is it possible to add an if component so that it only includes orders that start with 'EC' and ignores all others?

twl
You are welcome.

For your new question, try this (also an array formula so confirm with shift + ctrl + enter):
Code:
=MAX(IF(LEFT(C2:C20,2)="EC",RIGHT(C2:C20,4)+0))
Change range to match your data.
 
Upvote 0
If you are interested in formulas that do not require the Ctrl+Shift+Enter confirmation, you could try these (requires Excel 2010 or later)
I6 obtains the max for all cells
I7 the max for those starting with EC

Excel Workbook
HI
6EC12021209
7EC11981202
8EC1190
9BC1200
10BC1209
11BC1197
12BC1199
13BC1201
14BC1194
15BC1193
16BC1195
17BC1191
18BC1196
19BC1192
20BC1189
Max
 
Upvote 0

Forum statistics

Threads
1,223,907
Messages
6,175,300
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top