View Single Post
  #3   Report Post  
bj
 
Posts: n/a
Default

how many rows of data do you have and how many data points are there likely
to be Max in A?
if there are not very many and your data is in column a and b
sort the data set by column A
Select each segment of Column B for identical a values and copy
go to column d first row of A and paste special transpose do this for each
unique Column A value.
in coulumn C enter
=concatenate(D1:H1)
or whatever range is appropriate
if you use autofilter on coulumn D and select non blanks your display will
be approximately what you want.

or you could do a macro similar to

sub setup()
r=2 ' or whatever is appropriate for second row of data
rr=1 'or whatever row you want the output to start.
com=cells(r,1) 'ssuming Data is in first column
res = ""
while cells(r,1)<""
if cells(r,1)<cells(r-1,1) then
Cells(rr,3)=com
cells(rr,4)=res
rr=rr+1
else
res=res & " " & cells(r,2)
end if
r=r+1
wend
end sub

If you want a space between the outputs from the cells

Note this is a brute force level of macro, If it will be used a lot, it
should be more formal using option expicit and dim statments etc.





"adin" wrote:

I'd like this:

Column A Column B
A 1
A 2
A 3
A 4
B 1
B 2
C 1
D 1

to look like:

A 1 2 3 4
B 1 2
C 1
D 1

The numbers should be in the same cell, not different columns.

Easy, right?

Thanks.