To filter rows with empty cells in column D, you could do something like # 2, but as the error message suggested, you also need to filter out the second argument to ensure that the ranges are the same length. Fortunately, there is an easier way, namely using column indices rather than ranges:
=SORT(FILTER(sheet1!A2:L100;ISTEXT(sheet1!D2:D100));4;TRUE)
Alternatively, you can use the QUERY function for these kinds of things:
=QUERY(sheet1!A2:L100;"select * where D != '' order by D";0)
source share