Auto numbers are always incremental but from time to time will not be sequential.
Technical explanation
Salesforce will never attempt to make auto numbers consecutive (or sequential). To do so, even in the simple case of saving one single object one-at-a-time, no two create operations can be executed in parallel.
For example, the first create operation gets an auto number value of 15 and attempts to save to the database and it fails. If the second creation operation is being executed in parallel and has started (attempting to save the auto number value of 16) but cannot complete because 15 would be left out. As this situation generally involves more than just 2 records, one can see that the situation becomes much more complicated when we have bulk saves of multiple objects via the API where some of the rows may succeed and some may fail (due to apex triggers, for example). And when none of these complex operations can execute in parallel, the throughput will suffer, and system resources will be tied up.
Therefore, at this time, Salesforce has chosen to maintain performance in our code than to guarantee sequential order of auto number fields.
Workaround may be labor intensive and cannot guarantee exacting results as custom objects often reference other related records which may or may not be deleted based on this process (PROCEED WITH EXTREME CARE) when deleting any records from Salesforce.
For example, custom object has 300 records with the first 200 being numbered from 1-200 and the last 100 records shows auto numbering as 251-350.
***Again, we do not guarantee sequential auto numbers so this process may need to be repeated a few times until the result is reached for all records.
See also:
Restart or reset an 'Auto-Number' field
000383836

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.