Thankfully Excel stops you from sorting data ranges that have merged cells. If it didn't your spreadsheet would be a mess. To correct this issue, find the merged cells on your spreadsheet and see if it reall needs to be a merged cell. If not, unmerge it. If it does need to be a merged cell then determine if it needs to be in the range that is being sorted. If not, then just select what does need to be in the range. The best way to prevent this kind of situation is to better plan your spreadsheet when you are setting them up.