need vba help to clean up database

T

twist

I'm looking for a way to make this happen:

If a1 is equal to c1 delete a1 through f1 then move on to th
next row and do the same thing.

Can someone please help me
 
M

Max

Perhaps a formulas approach would also be feasible?

Assume source data is in Sheet1, cols A to H, from row1 down

Using an empty col to the right of the data, say col K
Put in K1: =IF(A1=F1,"",ROW())
Copy down by as many rows as there is data in cols A to H

In Sheet2
-------------
Put in A1:

=IF(ISERROR(MATCH(SMALL(Sheet1!$K:$K,ROW(A1)),Sheet1!$K:$K,0)),"",OFFSET(She
et1!$A$1,MATCH(SMALL(Sheet1!$K:$K,ROW(A1)),Sheet1!$K:$K,0)-1,COLUMN(A1)-1))

Copy A1 across to H1, fill down by
as many rows as there is data in Sheet1

Sheet2 will produce the "cleaned-up" results desired,
i.e. only rows where col A <> col F in Sheet1
will be extracted over, w/o any blank rows in-between

If necessary, kill all formulas in Sheet2
with an in-place: copy > paste special > values > ok
and delete Sheet1
 
M

Max

Sorry, some corrections to the assumptions and formulas
in the earlier post ..

In Sheet1
--------------
Assume source data is in Sheet1, cols A to H .. should be:
Assume source data is in Sheet1, cols A to F ..
Put in K1: =IF(A1=F1,"",ROW()) should be:
Put in K1: =IF(A1=C1,"",ROW())

In Sheet2
-------------
Copy A1 across to H1, fill down by should be:
Copy A1 across to F1, fill down by
 

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