You have a time frame. You compute the returns over that time frame for the S&P. You computer the returns over that time frame for all stocks in question. Sort the list of returns of the stocks, drop the returns less than the S&P returns. If you can't compute that I don't know what would be a better thing to do than to learn how.