Auto Num. ID

ZacCerrato

Board Regular
Joined
Jun 2, 2010
Messages
76
I would like to create a unique, numeric ID for each new line of a spreadsheet, similar to Access databases.

Is there a way for Excel to automatically create a numeric ID when information is entered onto a new row (i.e. B1, B2, B3), but to leave blank rows without a number? (Again, similar to the way that Access databases create unique numbers for rows.)
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
First, I would recommend waiting a bit longer than 27 minutes before bumping your posts. Note that when you bump them, they no longer appears on the list of threads with no replies, which lessens the views that it might get. I would recommend waiting at least a few hours before bumping. Many of the veterans here search for posts made within the past 24 hours with no replies first.

Back to your question, you get use a formula like this (assuming entering on row 1):
Code:
=IF(LEN(B1)>0,ROW(),"")
What this will do is if there is a non-blank entry in column B (on row 1), it will return the current row number, else it will return nothing. So if you copy that down for all rows, it will propulate the row numbers as entries are made in column B.

Alternatively, you may also be able to use a VBA solution that adds a counter as entries are made into column B (using a Worksheet_Change event procedure).
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,626
Members
452,933
Latest member
patv

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