Unique ID based on Next Column

Austin Lang

New Member
Joined
Sep 10, 2021
Messages
46
Office Version
  1. 365
  2. 2021
  3. 2019
Platform
  1. Windows
Hello friends,

Back again with another one..

Any assistance in throwing this together would be appreciated. The goal here is to have Column A here generate an ID only if Column B shows "Y". The ID needs to be formatted "24-XX". We also need it to be sequential from the last number generated. In this example, I would be looking at "24-13".

Thank you in advance.

1704521265538.png
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Try:

Dante Amor
AB
224-10Y
324-11Y
424-12Y
5N/AN
624-13Y
Hoja6
Cell Formulas
RangeFormula
A3:A6A3=IF(B3="Y","24-"&MAX(IF(B$2:B2="Y",RIGHT(A$2:A2,2)+1)),"N/A")
Press CTRL+SHIFT+ENTER to enter array formulas.


You must enter the first consecutive one manually, in this case 24-10.


If the consecutive has more than 2 digits:

Dante Amor
AB
224-10Y
324-11Y
424-12Y
5N/AN
624-13Y
Hoja6
Cell Formulas
RangeFormula
A3:A6A3=IF(B3="Y","24-"&MAX(IF(B$2:B2="Y",MID(A$2:A2,FIND("-",A$2:A2)+1,9)+1)),"N/A")
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Last edited:
Upvote 0
Solution
Since the number will eventually hit triple digits, I just started with the 2nd formula right from the start.

Thank you so much for the help!
 
Upvote 0
Since the number will eventually hit triple digits,
Here is a shorter one that you could try too. I also don't think that it should require Ctrl+Shift+Enter with your versions.

24 01 06.xlsm
AB
1
224-10Y
324-11Y
424-12Y
5N/AN
624-13Y
ID
Cell Formulas
RangeFormula
A3:A6A3=IF(B3="Y",24&LOOKUP(1,-MID(A$2:A2,4,9))-1,"N/A")
 
Upvote 0

Forum statistics

Threads
1,215,364
Messages
6,124,510
Members
449,166
Latest member
hokjock

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