Find the maximum or large of a string ID

kelly mort

Well-known Member
Joined
Apr 10, 2017
Messages
2,169
Office Version
  1. 2016
Platform
  1. Windows
Say I have
Code:
CPI_101
CPI_109


And more as IDs in my database . Can I use vba to find the largest number part?

It's looking trick for me.

Thanks
 
One last request :

How do I get only the digits after the "_"

That's after getting that largest ID into that cell, how do I get the digits after the underscore?

With static ones I can do with the "right function".

But now I am stacked :)
 
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
If you're referring to JoeMo' code then remove the part in red
Code:
If MaxVal > 0 Then
    LargestPartID = [COLOR=#ff0000]Prefix &[/COLOR] MaxVal
Else
    LargestPartID = CVErr(xlErrValue)
End If
 
Upvote 0
If you're referring to JoeMo' code then remove the part in red
Code:
If MaxVal > 0 Then
    LargestPartID = [COLOR=#ff0000]Prefix &[/COLOR] MaxVal
Else
    LargestPartID = CVErr(xlErrValue)
End If

Brilliant! !!

Working great
 
Upvote 0

Forum statistics

Threads
1,222,752
Messages
6,168,007
Members
452,160
Latest member
Bekerinik

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