be a lot easier if you added a "fixed column" class
<td class="fixed">Fixed columns</td>
<td>columns</td>
<td class="fixed">Fixed columns</td>
$('tr').each(function(){
var $notFixed=$(this).find('td').not('.fixed'); // create object of not fixed elements
$notFixed.filter(':last').remove() // remove last td using filter() method
$notFixed.eq(-2).remove()// remove second last using eq() method
$notfixed.eq(-1).after('<td>New element</td>') // add td after last "not fixed"
})