How to insert new data into a sortable table   Sorting makes the lists more useful but more marginally more difficult to add new data  Its not difficult once you understand that sorting numerically isnt 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 UseformatnumpadleftCCCC  Example formatnumpadleft produces  In case of a range like  only the first number needs to use the formatnum template to make it sortable The use of the tilde  destroys the sort order  I dont think its 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   YYYY YYYY BC Example  BC becomes expr     BC Note the space just before the  It is necessary For years AD We pad left N number of zeros to make the year  digits Use NYYYY Example  becomes  Example  becomes  Example  becomes  Example  becomes  Note there is no space before and after the  Also necessary  It looks more complex than it really is trust me