Append ID Number. Duplicates but Unique

jbklee

Board Regular
Joined
Apr 22, 2003
Messages
106
Can anyone assist please. Two orders displayed here, two IDs. I'd like to have a formula for Col E showing an appended Order ID per customer Code as example. So far, I have only worked out how to have an incremental number appended.

Order IDLine ItemCustomer CodeAppend Order ID
27861.120Yar2786.1
27861.120Yar2786.1
27861.120Yar2786.1
27861.140Noy2786.2
27861.140Noy2786.2
27861.140Noy2786.2
27861.210Abo2786.3
27861.210Abo2786.3
27861.210Abo2786.3
27871.120Eka2787.1
27871.120Eka2787.1
27871.120Eka2787.1
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
How about something like this:

1705706982788.png


The numbers are not exactly what you wrote in your OP, because the numbers are in alphabetical order. Abo is first, Noy second and Yar third.
Let me know if that works or do you need something else?

Also the formula in E2 requires excel version 2021 onwards. If you have an older version let me know and we'll try something else.

Excel Formula:
=LET(orderId, $A2,
customerCode, $C2,
orderIds, $A$2:$A$100,
customerCodes, $C$2:$C$100,
orderIdsCustomerCodes, SORT(UNIQUE(FILTER(customerCodes, orderIds=orderId))),
customerCodeIndex, MATCH(customerCode, orderIdsCustomerCodes,0),
orderId&"."&customerCodeIndex
)

I was thinking what would happen if you sort your data differently. Using the alphabetical order of the customer code the 1 will always be with Abo, the 2 with Noy, and so forth.
 
Last edited:
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

If you have a recent Excel version, this might suit you. I have provided two alternatives. Column F might be more useful if there can be more than 9 different customer codes per Order ID so that the appended bit would then go
.01
.02
.03
.
.
.09
.10
.11

If there could be 100 or more customer codes per Order ID then add an extra "0" in that last bit of the col F formula.

24 01 20.xlsm
ABCDEF
1Order IDLine ItemCustomer CodeAppend Order ID
227861.12Yar2786.12786.01
327861.12Yar2786.12786.01
427861.12Yar2786.12786.01
527861.14Noy2786.22786.02
627861.14Noy2786.22786.02
727861.14Noy2786.22786.02
827861.21Abo2786.32786.03
927861.21Abo2786.32786.03
1027861.21Abo2786.32786.03
1127871.12Eka2787.12787.01
1227871.12Eka2787.12787.01
1327871.12Eka2787.12787.01
jbklee
Cell Formulas
RangeFormula
E2:E13E2=A2&"."&ROWS(UNIQUE(FILTER(B$2:B2,A$2:A2=A2)))
F2:F13F2=A2&"."&TEXT(ROWS(UNIQUE(FILTER(C$2:C2,A$2:A2=A2))),"00")
 
Upvote 0

Forum statistics

Threads
1,216,081
Messages
6,128,696
Members
449,464
Latest member
againofsoul

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