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 example formatnum padleft 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 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 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