I have an Excel spreadsheet with 1 column, 700 rows. I care about every seventh line. I don\'t want to have to go in and delete the 6 rows between each row I care about. So
In my opinion the answers given to this question are too specific. Here's an attempt at a more general answer with two different approaches and a complete example.
OFFSET
approachOFFSET
takes 3 mandatory arguments. The first is a given cell that we want to offset from. The next two are the number of rows and columns we want to offset (downwards and rightwards). OFFNET
returns the content of the cell this results in. For instance, OFFSET(A1, 1, 2)
returns the contents of cell C2
because A1
is cell (1,1)
and if we add (1,2)
to that we get (2,3)
which corresponds to cell C2
.
To get this to return every nth row from another column, we can make use of the ROW
function. When this function is given no argument, it returns the row number of the current cell. We can thus combine OFFSET
and ROW
to make a function that returns every nth cell by adding a multiplier to the value returned by ROW
. For instance OFFSET(A$1,ROW()*3,0)
. Note the use of $1
in the target cell. If this is not used, the offsetting will offset from different cells, thus in effect adding 1
to the multiplier.
ADDRESS
+ INDIRECT
approachADDRESS
takes two integer inputs and returns the address/name of the cell as a string. For instance, ADDRESS(1,1)
return "$A$1"
. INDIRECT
takes the address of a cell and returns the contents. For instance, INDIRECT("A1")
returns the contents of cell A1
(it also accepts input with $
's in it). If we use ROW
inside ADDRESS
with a multiplier, we can get the address of every nth cell. For instance, ADDRESS(ROW(), 1)
in row 1 will return "$A$1"
, in row 2 will return "$A$2"
and so on. So, if we put this inside INDIRECT
, we can get the content of every nth cells. For instance, INDIRECT(ADDRESS(1*ROW()*3,1))
returns the contents of every 3rd cell in the first column when dragged downwards.
Consider the following screenshot of a spreadsheet. The headers (first row) contains the call used in the rows below.
Column A
contains our example data. In this case, it's just the positive integers (the counting continues outside the shown area). These are the values that we want to get every 3rd of, that is, we want to get 1, 4, 7, 10, and so on.
Column B
contains an incorrect attempt at using the OFFSET
approach but where we forgot to use $
. As can be seen, while we multiply by 3
, we actually get every 4th row.
Column C
contains an incorrect attempt at using the OFFSET
approach where we remembered to use $
, but forgot to subtract. So while we do get every 3rd value, we skipped some values (1 and 4).
Column D
contains a correct function using the OFFSET
approach.
Column E
contains an incorrect attempt at using the ADDRESS
+ INDRECT
approach, but where we forgot to subtract. Thus we skipped some rows initially. The same problem as with column C
.
Column F
contains a correct function using the ADDRESS
+ INDRECT
approach.