Discussion Locked

Writing every Nth record to Spreadsheet

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Recently one of my supervisors came to me with a problem. He had a spreadsheet of 20,000 records and had to check every 5th record. He wanted to know if there was an easier way than just going down the list five records at a time. This is what a client suggested:
1. Open the spreadsheet and create a new spreadsheet.
2. Left click on the first record.
3. Go to the new spreadsheet and left click on the same cell. Then press enter. A cell reference from the first sheet appears.
4. Return to the first sheet, left click the 5th record.
5. Then on the second sheet, left click the corresponding cell for the 5th record. Press enter. The cell reference for the 5th cell appears.
6. Highlight the cells from the first through the 5th cell.
7. Drag the highlight down through the corresponding number of records (ie 20,000)to the end of the spreadsheet using the AutoFill function. Every fifth record from sheet one appears on sheet 2.
8. Sort by non-Blanks and you have a spreadsheet with every 5th record.

It worked great for me. What do you think? Do you know another way?

2 replies

by rdschaefer

I would have used VBA:

dim nRow as integer
for nRow = 5 to 20000
if (nRow mod 5) = 0 then
{copy row from sheet1 to sheet2}
end if
next nRow

Ralph

This discussion is closed to new replies.