Numbering column A

Noir

Active Member
Joined
Mar 24, 2002
Messages
362
On my spreadsheet Column B has a series of data and every so often there is a blank row (to separate the data). I would like to use column A to place a number next to each data row in column B but, do not want the blank rows to be numbered. I tried to use "FILL" but, it numbered the blank rows.

Please advise.

Thx,
Noir
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
On 2002-04-03 08:27, Noir wrote:
On my spreadsheet Column B has a series of data and every so often there is a blank row (to separate the data). I would like to use column A to place a number next to each data row in column B but, do not want the blank rows to be numbered. I tried to use "FILL" but, it numbered the blank rows.

Please advise.

Thx,
Noir

In A2 enter and copy down:

=IF(LEN(B2),MAX($A$1:A1)+1,"")

where A1 is an empty cell.
 
Upvote 0
Or, if you prefer a VBA approach...

Sub test()

Lastrow = Range("B65536").End(xlUp).Row
Range("A1").Select
MyRow = ActiveCell.Row

MyCounter = 1

While MyRow <= Lastrow

Range("A" & MyRow).Select
If ActiveCell.Offset(0, 1).Value <> "" Then
ActiveCell.Value = MyCounter
MyCounter = MyCounter + 1
End If
MyRow = MyRow + 1

Wend

Rgds
AJ
 
Upvote 0

Forum statistics

Threads
1,213,507
Messages
6,114,029
Members
448,543
Latest member
MartinLarkin

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