This is a fantastic script by Ståle Hansen that is available for Lync 2010, Lync 2013 and Skype for Business 2015. It allows you to move away from spreadsheets for number management and utilize the real-time configuration of the Lync environment to know what numbers have been allocated and are in use.
The script is available from the TechNet Galleries:
More information is available on:
To customise for your deployment I have found the following things to complete:
1. Update the Custom Number Ranges for your sites
2. Set the number of digit you use for your extension length: