Find maximum number pith alpha prefix

KBBersch

New Member
Joined
May 31, 2017
Messages
3
I have a column that contains asset numbers in the form of PDL-xxxx and PTF-xxxx. I need to display the maximum number for each prefix, or better yet the next available number for each prefix. More entries will be added and the cells need to update as that happens. I tried =INDEX($B$6:$B$1001,MAXA(IF((LEFT($B$6:$B$1001)="PTF"),$B$6:$B$1001))) but that always returns the first entry in the column. I know I'm missing something but I'm not sure where to go from here. Any help is appreciated.

Thanks,
Kelly Bersch
 
If you put the 1+ inside the MAX function call, then you can eliminate the double minus in front of the RIGHT function call as doing that would involve the RIGHT function in a mathematical operation the same as the double negative did...

=TEXT(MAX(1+IF(LEFT(B$6:B$1001,3)=D6,RIGHT(B$6:B$1001,4))),CHAR(34)&D6&CHAR(34)&"-0000")

Good idea

And then, if you want to save 9 characters, you can use proper quoting in place of the CHAR(34) calls...

=TEXT(MAX(1+IF(LEFT(B$6:B$1001,3)=D6,RIGHT(B$6:B$1001,4))),""""&D6&"""-0000")

Yes, i know this is possible, but every time i get confused with so many quotes, so I prefer CHR (34) ;)

M.
 
Upvote 0

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,224,827
Messages
6,181,194
Members
453,021
Latest member
pingpong7117

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