Next Number

Pestomania

Active Member
Joined
May 30, 2018
Messages
332
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have the following data (to start with) and am trying to create a "unique sku" for each category

CategoryCategory 2Sku Start
Key ChainState ShapedKC0000
CoasterState PuzzleC00000

I would like to take the first letter of each word in the "Category" column and that is the first identifier in SKU Start.

And then I am hoping to get it to look for any SKU that already exists (in this case KC0000) and pick the next one which would be KC0001.

The SKU should always be 6 digits.

So a possible table would be:

CategoryCategory 2Sku Start
Key ChainState ShapedKC0000
CoasterState PuzzleC00000
Key ChainFunnyKC0001
Key ChainTarotKC0002

Thank you!
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
See if this is what you want.

24 11 09.xlsm
AC
1CategorySku Start
2Key ChainKC0000
3CoasterC00000
4Key ChainKC0001
5Key ChainKC0002
6Key ChainKC0003
7StickS00000
8CoasterC00001
9StickS00001
10StickS00002
11Key ChainKC0004
SKU
Cell Formulas
RangeFormula
C2:C11C2=LET(r,C$1:C1,pref,CONCAT(LEFT(TEXTSPLIT(A2," "),1)),x,LEN(pref),prev,FILTER(r,(LEFT(r,x)=pref)*ISNUMBER(-MID(r,x+1,1))*(r<>C$1),pref&"-1"),pref&TEXT(MID(TAKE(prev,-1),x+1,5)+1,REPT(0,6-x)))
 
Upvote 0
Solution

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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