Saturday, October 29, 2011

Select Every \(n^{th}\) Row in Excel

Today, I processed some Excel file and tried to select other row in a spreadsheet. Again, I am discussing the way with Excel, not programmatic.

Actually, my problem can be generalized to select every \(n^{th}\) row in the spreadsheet. The approach is based on Excel filter and described as below.

Excel version: 2010
Suppose the data area is C10:E20, and I am going to select every 3rd row.
  1. In a separate area from the data matrix to be selected, locate a cell at the same row as the data area. Pick A10 in my example.
  2. Type in the cell A10 =MOD((ROW(A10)-ROW(A$9)), 3), and press Enter.
  3. Using autofill feature to complete all rows 10 to 20.
  4. Locate Cell A10, click Filter under Data menu.
  5. Select 0 only from the drop-down list.
  6. Copy the filtered data into another separate area or a new sheet.
  7. If copied in the same sheet, clear Filter to see complete data.

No comments:

Post a Comment