Autonumber Column

L

Legacy 436357

Guest
Hello,

I have a Customer table that I would like the first column to autonumber to the next higher number.

When sorting the table can that number remain with the Customer?

What I have tried so far doesn't keep that ID with the Customer when sorting the table columns.

Thank you
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
If you are just using native Excel formulas, it will probably not work the way you need.
You will probably need to hard-code the value, which will require VBA (if you do not want to do it manually).

If you need help creating that VBA code, please provide the following information:
- In which columns to these numbers occur?
- Are they straight numbers, or is there also some text mixed in with them?
- Should it always look for the maximum number currently in the column, and add one to it for the next number?
- When should a new number be added/created? (Do you want to run something manually, or have it triggered to happen automatically upon some event happening? If the later, what is the event that should trigger it to run?)
 
Upvote 0
Thanks Joe I attached here what I have in mind. Can this be done to autonumber the IDs for each Customer so when I sort any of the columns that ID remains with the Customer?

Excel Workbook
BCDEFGHIJK
2IDCompany NameContact NameBilling AddressCityState or ProvincePostal CodePhone NumberE-Mail AddressNotes
3101
4102
5103
Sheet1
 
Last edited by a moderator:
Upvote 0
How exactly are new customers being added?
Are they being imported, copied in from somewhere, or is someone manually keying them?
If they are being manually entered, will the Company Name ALWAYS be filled out?
My thinking is to have code automatically run when Company Name is populated to populate the ID column.
 
Upvote 0
I figured it out without using VBA thanks anyway.
Please post how you did it, so it may help future people with the same question (and I am curious how you did it too).
 
Upvote 0
In cell B3 =LEFT(C3,3)&RIGHT(I3,4)

This assigns the first 3 digits of company name and last 4 digits of phone number.

The columns sorted always keep this ID with the Customer.
 
Upvote 0
Ah, okay. So you switched from using an Autonumber to using a field calculated from some of the record details.
Just note that if company name or phone number switches, so will you ID number (I deal with a lot of client stuff, and compnay name changes are not uncommon).
So if you need the ID to be static and never changing, that probably won't work for you.
 
Upvote 0
It is not likely the case in my situation. If the company name changes or the phone number it will still be applied to any past records for referencing.
 
Last edited by a moderator:
Upvote 0
OK. As long as it works for you. Just something to be aware of.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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