• 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.

Repeat name based on number of email id

Greetings!!
I have data into which vendor name comes once but that has more than 1 email id. I want to repeat the vendor name in different rows based on the number of email ids. For example : for 5 email id related to single vendor, vendor names should repeat 5 times.
File has been attached for more clarity

Any non VBA solution would be much appreciated

Thanks in advance!!
 

Attachments

  • EXCEL QUERY.xlsx
    9.4 KB · Views: 14
Assuming you already have process to separate out each email to individual lines. To get matching vendor name...
=INDEX($A$2:$A$3,MATCH("*"&D7&"*",$D$2:$D$3,0))
Copy down.
 

Attachments

  • EXCEL QUERY.xlsx
    11 KB · Views: 9
1. "*" is used as wild card. So, if the email string (found in D7~) is found anywhere in the cell referenced (ex. D2) it will be considered a match.

2. Easiest way I can think of requires VBA. Without it, I'd do following.
- Copy D2 to D7
- Go to Data tab->Text to Columns->Delimited->Comma
- Set Destination to E7
- Copy resulting data
- With D7 selected Paste Special->Transpose (Alt+e+s & then e)
Repeat. At the end, you can delete column E~.
 
Try the formula solution to repeat Vendor names and separate Email IDs.

1] Helper B2, copy down :

=(LEN(D2)-LEN(SUBSTITUTE(D2,", ","")))/2+1

2] Vendor name A7, copy down :

=IFERROR(INDEX(A$2:A$3,MATCH(1,INDEX(--(COUNTIF(A$6:A6,A$2:A$3)<B$2:B$3),),)),"")

3] Email ID D7, copy down :

=IF(A7="","",TRIM(MID(SUBSTITUTE(", "&VLOOKUP(A7,A$2:D$3,4,0),", ",REPT(" ",50)),COUNTIF(A$7:A7,A7)*50,50)))

Regards
Bosco
 

Attachments

  • EXCELQUERY2.xlsx
    10.5 KB · Views: 8
Thanks to all!!

@Bosco, that formula worked very well. But I afraid of using it incorrectly as apart from correct result in some cell, in other cells result are being shown like this
a

ccounts@gmail.com

abc@

gmail.com

Please suggest
 
Back
Top