In Excel, how to fill down consecutive integers following a pattern 1, 1, 2, 2,

In Excel, I know how to use the "fill down" feature to populate a column of sequential numbers.

I would like to do this but following a pattern like:

1
1
2
2
3
3

Does anyone know how to do this? I cannot figure it out. When I try to use the fill down feature it tries to calculate a trend over the values such as 3.3, 3.7, 4.2, 4.8, etc.


I don't think Excel includes the logic to do this, although I'll be happy to be proved wrong.

A workaround would be to use a formula copied down the column, then use PasteSpecial>Values to overwrite with the desired values.

   A       B        C
1  1
2  1
3  =A1+1
4  =A2+1
5  =A3+1

etc.


No Excel here, but in OpenOffice.org, filling down the following value and formula:

      A
1     1
2   =A1

...gets me new values and formulas:

      A
1     1
2   =A1
3     2
4   =A3
5     3
6   =A5
7     4
8   =A7

...which displays as you want it to.


For a pure formula version,

=ROUNDUP(ROW(A1)/2,0) will fill down correctly. (If starting further down than row 1, subtract as needed.)


You could do the following. Bit heavy handed, but allows for you to do more advanced things in the if check to produce more obsure patterns.

After the first two manual entries it does not rely on you coping a "block" to get the repeated pattern. The if statement does if for you.

     A
1    1
2    1
3    =IF(A2==A1,A2+1,A2)
4    =IF(A3==A2,A3+1,A3)
etc