Help with IF/Aggregate formula that finds next number/letter sequence

willow1985

Well-known Member
Joined
Jul 24, 2019
Messages
888
Office Version
  1. 365
Platform
  1. Windows
I have the below formula that finds the next number letter sequence in column A of sheet "Batch Log" depending on which letter is selected in cell J2

For example:
if letter "A" is selected the next sequence from "Batch Log" it would give is A137
if letter "B" is selected, the next sequence the formula would give would be B1847
"C" is C611 and so on

There is one problem, the number next sequence for "D" needs to be D067 however the formula returns D67 and skips the 0.

This formula has been working great for me but I couldn't help but be curious if there was a way to account for the "0" for "D"

Current formula:

=IF(J$2="","",J$2&AGGREGATE(14,6,MID('Batch Log'!A$1:A$10000,2,9)/(LEFT('Batch Log'!A$1:A$10000,1)=J2),1)+1)

Any ideas would be appreciated

Thank you

Carla
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Does this solve the problem?

=IF(J$2="","",J$2&TEXT(AGGREGATE(14,6,MID('Batch Log'!A$1:A$10000,2,9)/(LEFT('Batch Log'!A$1:A$10000,1)=J2),1)+1,"000"))
 
Upvote 0
Sorry for the late response, this works perfect!

Thank you so much ? ?
 
Upvote 0
You're welcome. (Better late than never. :))
 
Upvote 0

Forum statistics

Threads
1,214,823
Messages
6,121,777
Members
449,049
Latest member
greyangel23

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