Rename duplicates with random alphabets in a column - Excel

浪子不回头ぞ 提交于 2019-12-01 13:46:43

If you prefer to use a non-random prefix that just contains the next letter, you could do something like this starting in C2:-

=IF(B2=B1,CHAR(96+COUNTIF(B$1:B1,B2))&"."&B1,B2)

I'm assuming that the names are sorted, have a heading and are in column B.


If you didn't want to sort them, this would still work with a modification:-

=IF(COUNTIF(A$1:A1,A2)>0,CHAR(96+COUNTIF(A$1:A1,A2))&"."&A2,A2)

I'm assuming that the unsorted names are in column A, with a header.

Without using VBA - you can't edit the cells themselves, except using formatting.

You could however, use a helper column and use a formula on these lines to accomplish this:

=IF(A2=A1,CHOOSE(RANDBETWEEN(1,26),"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z")&" "&A2,A2)

Bear in mind that because this is random, there is a small chance of two consecutive letters - so you may need to use another formula to check for this and make a small amount of manual tweaks.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!