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
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
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
 
Upvote 0
For example, if 1 is entered in A1, then in A2:

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


filled down.
 
Last edited:
Upvote 0
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.
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,214,789
Messages
6,121,605
Members
449,038
Latest member
Arbind kumar

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
Back
Top