Google-sheets – I need help with sorting query in Google Sheets

google sheetsgoogle-sheets-querysortingzapier

I have a zap that pulls "Email" data from a spreadsheet, I also have a query that pulls "NAME" data from a different spreadsheet, but when I try to sort it, the data gets misplaced, eg. blank rows appear on top, and in the middle the data gets misaligned.

I'm attaching 2 screenshots to show the problem.

http://prntscr.com/e9b7yu <- Data is not sorted just placed as it is in the original sheet.

http://prntscr.com/e9b8gj <- Data is sorted by A-Z. As you can see the data is misplaced and many email don't match the respective names.

When I sort data by Z-A some emails match, while others don't.

My question is if there's some sort of a code or something to stop this from happening.

Best Answer

It seems you are sorting a single column when you need a pair to be sorted together. Taking what is on the left and clicking Sort as shown should return the order as shown on the right:

WA103168 exmple