Autonumber not in order

LxQ

Well-known Member
Joined
Feb 9, 2006
Messages
619
I have a table that was generated from an update query. The table is just one column containing either numbers or just being empty. They are also sorted, so the empty cells are on top, numbers are sorted. Numbers range from 1 digit to 5 digit numbers.

I open the table in Design View mode, add a second row, give it a Field Name, and for Data Type I select AutoNumber. Then I save the table and to back to Datasheet View.

The autonumbering isn't in order. It's like the following table, where col A is the values I had and col B is the autonumber just added:

[A ] B
[ ] 4
[ ] 5
[ ] 6
[6 ] 3
[77 ] 2
[128 ] 1
[9521 ] 10
[9816 ] 9
[10200 ] 8
[10992 ] 7

Basically numbers with 1-3 digits are autonumbered first in reverse order, then empty spaces, then 4-5 digits numbers, also reverse order. Any idea why?
 
Last edited:

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
autonumbers don't imply a specific sort ordering. Generally, they will be given increasing numbers as they are added but that's nothing that's guaranteed. So the answer is simply that there is no order implied when making a field an autonumber field (note: what is guaranteed is uniqueness).
 
Last edited:
Upvote 0
To further comment on what xenou said, best practices say that you shouldn't use Autonumber for any sort of ordering, if the order matters (for the reasons xenou mentioned).
You should only use it to obtain a unique ID, nothing more, nothing less.
If you have needs to order in a certain way that cannot be obtained from other fields, then you would probably need to create your own ID field (probably generated via VBA) that you can sort by.
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
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