how to get one row out of every two rows?

  • Thread starter Thread starter MCI
  • Start date Start date
M

MCI

suppose file1 has 200 rows, i want to get the first row, third row,
fifth row, ..., and put these 100 rows to a new file (file2). do i have
to use vba, or i can directly do it in excel

thanks a lot!
 
Hi

You could use a helper column and (in row1) place the following
formula:

=MOD(ROWS($A$1:$A1),2)

and copy down. Now you can use Autofilter (filter on the 1s) and then
copy and paste the visible rows.

Hope this helps!

Richard
 
VBA not needed.


In a helper column, say column Z, in Z1 enter
1
in Z2 enter
=IF(Z1=0,Z1+1,0) and copy down
you will see a column of alternating 1's and 0's

Then use autofilter to hide all the 0's (even rows) and copy/paste.
 
Helper column, formula =MOD(ROW(),2)
Autofilter by that column, choosing value 1.
Copy the displayed column to your new file.
 
thanks a lot, appreciate it!
Hi

You could use a helper column and (in row1) place the following
formula:

=MOD(ROWS($A$1:$A1),2)

and copy down. Now you can use Autofilter (filter on the 1s) and then
copy and paste the visible rows.

Hope this helps!

Richard
 
If this is an on going project, you can try this formula to copy over every
other row from Sheet1 to another sheet.

As you add more data to Sheet1, simply extend (copy) the formula down
additional rows to compensate for the new data.

=INDEX(Sheet1!A:A,2*ROWS($1:1)-1)
 

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

Back
Top