The warehouse board needs a job name and a time estimate. The supervisor still wants priority to drive the order. SORTBY lets you use priority from a separate column while returning only the two columns readers need.

In A2:C5, enter these rows in the order shown.

Job

Minutes

Priority

Stage

12

3

Label

7

1

Scan

18

2

Repack

15

1

An input table shows four jobs, with Repack and Label tied at priority 1 and different durations.

Example queue. The highlighted priority column controls the order but stays out of the output.

Clear E2:F5 and enter =SORTBY(A2:B5,C2:C5,1,B2:B5,-1) in E2. The first sort puts priority 1 before 2 and 3. The second puts the longer job first within a tie. Because the returned array is A2:B5, the priority column stays outside the result.

The result lists Repack, Label, Scan and Stage, with minutes retained beside each job.

Example output. The longer job appears first when two priorities tie.

Expect Repack, Label, Scan and Stage. Check that each duration traveled with its job. A change to C2:C5 should reorder the output without adding a third column.

Microsoft’s SORTBY reference.