How can I add a single character to a duplicate cell in Excel

laundon

New Member
Joined
Jan 5, 2005
Messages
18
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hi,

I have used this forum many times over the years for help and hope this time, you can help again!

To explain, I have a spreadsheet of part numbers or product codes. Each part number originally had a prefix, say, AA-1234. I had the need to remove the "AA-" part. This then gives me a column with a part number without a prefix, however I may now have duplicates as AA-1234 and BB-1234 will both now be 1234.

What I am trying to do is on the duplicate line only, add a suffix character to make it unique again and I can't work out how to do it!

So to continue my example from above, the duplicate line only would then become 1234D for example making it now unique, so I would have 1234, and 1234D

Any ideas from you fabulous bunch of people?

Many Thanks, and Festive Greetings to you all!

Tim.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
How many duplicate would be for 1234? Could you pls post screenshot of actual data?
 
Upvote 0
add "D", "E" ... for each duplicate item (not excess 24 )

Book1
AB
1CC-12341234
2AA-12341234D
3AA-56785678
4BB-12341234E
Sheet1
Cell Formulas
RangeFormula
B1B1=RIGHT(A2,LEN(A2)-SEARCH("-",A2))
B2:B4B2=RIGHT(A2,LEN(A2)-SEARCH("-",A2))&IF(COUNTIF($A$1:A1,"*"&RIGHT(A2,LEN(A2)-SEARCH("-",A2))),CHAR(COUNTIF($A$1:A1,"*"&RIGHT(A2,LEN(A2)-SEARCH("-",A2)))+67),"")
 
Upvote 0
How many duplicate would be for 1234? Could you pls post screenshot of actual data?
There is going to be possibly no more than 5 duplicates maximum I would have thought.

Basically, I have a product list in Excel that I'm trying to import into some software, The product codes need to be unique. In the spreadsheet, the prefix is a supplier code and I I need the list without supplier code. This then gives me the duplicates.

I can't share the file unfortunately as it's customer data.
 
Last edited:
Upvote 0
Many thanks for the replies so far.

I already have a cell with the prefix removed.

All I need to do now is add something to the end of the duplicate entry to make it unique and leave the other instance for the number untouched, so I'm left with 1234, and 1234D for example.
 
Upvote 0
My interpretation

21 12 14.xlsm
BC
112341234
212341234B
355555555
412451245
598769876
655555555B
712341234C
Mark Dupes
Cell Formulas
RangeFormula
C1:C7C1=B1&SUBSTITUTE(CHAR(64+COUNTIF(B$1:B1,B1)),"A","")


Or if you want the first dupe suffix to be "D", then

Excel Formula:
=B1&SUBSTITUTE(CHAR(66+COUNTIF(B$1:B1,B1)),"C","")
 
Upvote 0
Is there a way to add a number at the end instead of the letter? I have pretty much the same situation but instead of having 4 numbers I need to make unique I have 4 letters. Thanks.
 
Upvote 0
This is a sample of my input and desired output
 

Attachments

  • 1652411514141.png
    1652411514141.png
    5.5 KB · Views: 58
Upvote 0

Forum statistics

Threads
1,223,532
Messages
6,172,879
Members
452,486
Latest member
standw01

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