• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Adding A Cell Value To Existing Cell If Duplicate Found

I have a list of email addresses in column C30:C1030


I have another list of names in column D30:1030


I'm trying to write a code that will add the cell value text "(1 of 3)" and "(2 of 3)..etc" to the right of names already in column range D30:D1030 (but only if a dupe is found).


If there's 4 dupe email addresses in column C, then I'm trying to get it to auto-format like Name (1 of 4), Name (2 of 4)...etc.


Example: If column C contained Derek.Jeter@YankeeMail.net appearing twice, then code would write the values in Column D to read Derek Jeter (1 of 2) and Derek Jeter (2 of 2) accordingly -because there were two dupes found in the Column C email range range.


So ultimately, when I launch my batch email sender from excel, if a recipient has more than one email message I'm sending them it will list them this way accordingly (for better clarity).


Just trying to figure out an auto-way of attaching that (1 of..) to the names in column D. Why I chose the yankees and Derek Jeter for my example of all people I have no idea.

lol


Here is the tricky part though...


Would it be possible for the code to auto update the numbering of (1 of 2) and (2 of 2) already appended to the names in column D if I add another email address?


Why I got stuck on this one, is I wanted the code to actually auto update to (1 of 3) (2 of 3) (3 of 3) if necessary automatically pending I added a third email address.


Or (1 of 4) (2 of 4) (3 of 4...etc depending on however many dupes I keep adding.
 
Quick formula to get your numbering:

="("&COUNTIF(D$30:D30,D30)&" of "&COUNTIF(D$30:D$1030,D30)&")"


Concatenate any way you desire to attach to the name. Bonus of this is, the formulas will update if you add another entry.
 
Back
Top