Create number series in excel

Shweta

Well-known Member
Joined
Jun 5, 2011
Messages
514
Hi All,

Please suggest how to create the following series in excel 2007

1
2
2
3
3
3
4
4
4
4
5
5
5
5
5... so on

Thanks in advance!

Regards,
Shweta
 

Some videos you may like

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
With a macro

Code:
Sub test()
Dim i As Long
For i = 1 To 10
    Range("A" & Rows.Count).End(xlUp).Offset(1).Resize(i).Value = i
Next i
End Sub
 

AdamL

Well-known Member
Joined
Sep 25, 2008
Messages
767
For example, if 1 is entered in A1, then in A2:

Code:
=A1+(COUNTIF(A$1:A1;A1)=A1)


filled down.
 
Last edited:

hurgadion

Active Member
Joined
Mar 19, 2010
Messages
426
Hi,
I propose VBA Solution with a double Loop:
Code:
Sub test()
Dim i&, j&, x&

For i = 1 To 10
  For j = 1 To i
     x = x + 1
     Cells(x, 1).Value = i
   Next j
Next i
End Sub
Best regards.
 

Shweta

Well-known Member
Joined
Jun 5, 2011
Messages
514

ADVERTISEMENT

Thanks Vog and AdamL!
 

hurgadion

Active Member
Joined
Mar 19, 2010
Messages
426
Another, shorter Solution: :)
Code:
Sub test2()
Dim i&

For i = 1 To 55
  Cells(i, 2).Value = Int(1 / 2 * (Sqr(8 * i - 7) - 1) + 1)
Next i
End Sub
Of course, VoG's Solution is more useful... :) Best regards.
 

Watch MrExcel Video

Forum statistics

Threads
1,123,089
Messages
5,599,667
Members
414,326
Latest member
Aerith

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top