How to insert new data into a sortable table Sorting makes the lists more useful but more marginally more difficult to add new data It s not difficult once you understand that sorting numerically isn t possible because of BC in some of the years and commas in the casualty figures All we are doing here is converting those numbers into an alphabetic format that the table can sort Sorting for casualties zero padding is necessary if we are going to use comma separators CCCC represents the casualty number Use formatnum padleft CCCC 7 0 Example formatnum padleft 300000 7 0 produces 0 300 000 In case of a range like 5 000 10 000 only the first number needs to use the formatnum template to make it sortable The use of the tilde destroys the sort order I don t think it s really necessary since almost all of these numbers are approximate anyway To make years sortable we have to insert invisible characters before the actual values To do this we use anything here is invisible YYYY represents the year For years BC Use expr 9999 YYYY YYYY BC Example 846 BC becomes expr 9999 846 846 BC Note the space just before the It is necessary For years AD We pad left N number of zeros to make the year 4 digits Use NYYYY Example 3 becomes 0003 Example 34 becomes 0034 Example 345 becomes 0345 Example 1456 becomes 1456 Note there is no space before and after the Also necessary It looks more complex than it really is trust me