Our Goal is to merge the names (B) when the data in A is equal. The formula below looks at the next line (A), if it's the same, it merges data (name) from B. The formula is in C, so the result of the merged names will appear in C.
`=IF(A2<>A3,B2, B2&" , "&B3)`

*Example*: **if** `A2:XYZ`

**and** `A3:XYZ`

**then** merge `B2:Sam`

and `B3:Dan`

in `C = "Sam, Dan"`

.

*Problem*: We need to display all the names merged into one cell (C) that have a matching A, skipping the duplicates..

**If** `A1:A4 = XYZ,`

**and** B1:Sam B2=Dan B3=Dan B4=Joe` **Then** results in C should read "Sam, Dan, Joe"

Any suggestions would be appreciated.

`if loop`

in VBA to do this. If you have the correct formula, can you loop it as a macro? Can you post your workbook? – Raystafarian Feb 7 '12 at 20:28`data - remove duplicates`

before performing your`=if()`

function? What excel are you using? – Raystafarian Feb 8 '12 at 16:58