You will have to loop through all the TDs and check the background color.
Using grep
alert(
$.grep($('td'),function(TD){
return $(TD).css('background-color') == 'rgb(255, 255, 0)';
}).length
);
Or filter which is better for DOM elements
alert(
$('td').filter(function(){
return $(this).css('background-color') == 'rgb(255, 255, 0)';
}).length
);