Indexing data in Multiple Columns

G

Guest

In a spreadsheet I have a list of customers with an account number in the
first column and company name in the second column. The next 8 columns are
made up of pairs of columns which have an account number and the sales made
to that account number. I have sorted these columns by account number to try
and line up the rows for each account's sales but because some accounts do
not have any sales in some years and I have over 3000 accounts after the
first few rows the sales are hopelessly misaligned. Is there a sort command
that will get my annual sales to line up with their account number shown in
the first column?
 
B

Bill Kuunders

You would need to get the 4 pairs of columns (CD EF GH and IJ)under neath
each other in CD
first.
Then sort the the C and D column in the same manner as in the A column. I
assume the A column is sorted in ascending order already.
 
P

PY & Associates

We would try

set rng1 = range(cells(1,1),cells(lastrow, 1))
set rng3 = range(cells(1, 3),cells(lastrow, 3))
set rng5 = range(cells(1, 5),cells(lastrow, 5))
set rng7 = range(cells(1, 7),cells(lastrow, 7))
for each cell in rng1
for i = 3 to 7 step 2
do
foundrng = rng & i.find(cell, findnext, afterlastcell)
if not foundrng is nothing then
foundrng.resize(1,2).copy cells(cell.row,
columns.count),end(xltoleft))
else
exit do
end if
loop
next i
next cell

if visual inspection OK
columns("3:8").delete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top