excel - Merge the cell values if duplicates exist -
i want merge values in column b if duplicates exist in column a
b 123 123 b 123 c 456 d 456 e 789 f
my output should this
b 123 b c 456 d e 789 f
i have large amount of data , hard manually ,so u guys have idea in macros in excel?
any appreciated..thanks in advance
in case want resultant data in same cells original data existed ie not in cell 10, have store source data in 2 dimensional array. array have use above code insert data in same place original data existed. here goes listing accomplish task:
private sub worksheet_beforedoubleclick(byval target range, cancel boolean) dim names(2 7, 2) = 2 7 names(i, 1) = cells(i, 1) names(i, 2) = cells(i, 2) next on error resume next: sheet1.cells.clear cnt = 2 = 2 7 strg = strg + names(i, 2) if names(i + 1, 1) <> names(i, 1) cells(cnt, 1) = names(i, 1) cells(cnt, 2) = strg cnt = cnt + 1 strg = "" end if next end sub
please note have declared names array 2 dimesnions store data. array searched result.
Comments
Post a Comment