Help with adding unique codes to numbers

Cruiser69

Board Regular
Joined
Mar 12, 2018
Messages
61
Office Version
  1. 365
Platform
  1. Windows
Hi all.
Just joined and would like to know if anyone could please answer a query I have.
I have a sheet with multiple pallet codes in column A as in the example below.
One pallet number could contain up to 500 items which can all be different.

123456
123456
123456
111222
111222
222112
222112

Is it possible to add a two letter code of my choice to column B as below

123456 BA
123456
123456
111222
111222
222112
222112

Then for it to autofill down and when it gets to the next unique number, it will change as below
123456 BA
123456 BA
123456 BA
111222 BB
111222 BB
222112 BC
222112 BC

I'm not sure if this is possible, but I'm sure one of you experts out there will let me know either way.


Thanks for looking,

Graham
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
How would you decide on which 2 letter code to assign to which unique number?
 
Upvote 0
I would just filter the pallet numbers from low to high, then give the first one the unique number

I should have given a better example as below :)

111111 BA
111111 BA
111111 BA
222222 BB
222222 BB
222222 BB
333333 CC
333333 CC

Graham
 
Upvote 0
Maybe:

AB
1PalletCode
2123456BA
3123456BA
4123456BA
5111222BB
6111222BB
7222112BC
8222112BC

<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet3

Worksheet Formulas
CellFormula
B3=IF(A3=A2,B2,LEFT(ADDRESS(1,COLUMN(INDIRECT(B2&1))+1,4),2))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Put the 2-letter code you want in B2, then the formula in B3 and drag down.
 
Upvote 0
Hi Eric.
All I am getting is what you see below

111111 BA BA
111111 0
111111 #REF !
222222 0
222222 0
222222 0
333333 #REF !
333333 0

Graham
 
Upvote 0
Sorry Eric, my bad. I didn't read you answer correctly. I was adding the formula to column C :eek:

This works a treat. Thanks for your help

Graham
 
Upvote 0

Forum statistics

Threads
1,214,584
Messages
6,120,385
Members
448,956
Latest member
JPav

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