Numbering fixed amount of Rows

nymyth

Board Regular
Joined
Mar 4, 2010
Messages
104
Hey team,

I have a worksheet that has rows numbered (in col A) from 1 - 77,757. In col B I want to number each group of rows in deciles. So Rows 1 - 7,776 should show me "1" in col B. Rows 7,777-15,52 should show me "2" in column B and so on. Is there a quick formula that can help me achieve this?

Thanks as always.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Perhaps = CEILING(A1/7776,1) in B1 and pull down ( or auto fill)
 
Upvote 0
Here is a macro that will fill your range with constants rather than formulas...
Code:
Sub Deciles()
  Dim R As Long
  For R = 1 To 69985 Step 7776
    Cells(R, "B").Resize(7776).Value = Int((R + 7776) / 7776)
  Next
  Range("B77758:B77760").Clear
End Sub
 
Upvote 0
Here is a macro that will fill your range with constants rather than formulas...
Code:
Sub Deciles()
  Dim R As Long
  For R = 1 To 69985 Step 7776
    Cells(R, "B").Resize(7776).Value = Int((R + 7776) / 7776)
  Next
  Range("B77758:B77760").Clear
End Sub

Both did the trick, thank you so much.
 
Upvote 0
Both did the trick, thank you so much.
Actually, using Arthur's formula as a base, we can do the macro without using a loop...
Code:
Sub Deciles()
  Range("B1:B62208") = [IF({1},CEILING(ROW(A1:A62208)/7776,1))]
  Range("B62209:B77757") = [IF({1},CEILING(ROW(A62209:A77757)/7776,1))]
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,219
Members
452,619
Latest member
Shiv1198

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