TopicsCheat sheetLessons
Lurndo › Excel › SORT and SORTBY

Learning Excel: SORT and SORTBY

Sorting with a formula

On the screen at the entrance, Will wants the shortest queue at the top. The table itself has to stay as it is: the tills use that order. A formula makes a sorted copy.

SORT

SORT gives a sorted copy of a range. =SORT(A2:D13,3) sorts on the third column of the range, the queue time, from small to large.

With -1 as the third argument, you sort from large to small: =SORT(A2:D13,3,-1).

G2
fx

=SORT(A2:D13,3)

ABCDEFGHIJKLMN
1RideZoneQueue timeVisitorsHeightResultZoneWater
2WhirlwindWater451,200120Pedal BoatsWater5400Max. wait20
3Haunted CastleAdventure25800100CarouselKidsland5600Child height105
4Log FlumeWater351,500110DodgemsFunfair10650
5DodgemsFunfair10650130Mini TrainKidsland10500
6Big WheelFunfair1590090TeacupsFunfair10700
7Pirate ShipAdventure301,100110Big WheelFunfair15900
8Pedal BoatsWater540085Haunted CastleAdventure25800
9CorkscrewAdventure501,700140Pirate ShipAdventure301100
10Mini TrainKidsland1050085Log FlumeWater351500
11RocketSpace401,300130RocketSpace401300
12CarouselKidsland560085WhirlwindWater451200
13TeacupsFunfair1070095CorkscrewAdventure501700
14

SORTBY

Want only the names, sorted on a column you don't show? Then you use SORTBY: first what you want to see, then what you sort by.

=SORTBY(A2:A13,D2:D13,-1) gives the names, the most visitors at the top.

G2
fx

=SORTBY(A2:A13,D2:D13,-1)

ABCDEFGHIJKLMN
1RideZoneQueue timeVisitorsHeightResultZoneWater
2WhirlwindWater451,200120CorkscrewMax. wait20
3Haunted CastleAdventure25800100Log FlumeChild height105
4Log FlumeWater351,500110Rocket
5DodgemsFunfair10650130Whirlwind
6Big WheelFunfair1590090Pirate Ship
7Pirate ShipAdventure301,100110Big Wheel
8Pedal BoatsWater540085Haunted Castle
9CorkscrewAdventure501,700140Teacups
10Mini TrainKidsland1050085Dodgems
11RocketSpace401,300130Carousel
12CarouselKidsland560085Mini Train
13TeacupsFunfair1070095Pedal Boats
14

Try it yourself

Sort A2:D13 in G2 by visitors, the fewest at the top.

ABCDEFGHIJKLMN
1RideZoneQueue timeVisitorsHeightResultZoneWater
2WhirlwindWater451,200120Max. wait20
3Haunted CastleAdventure25800100Child height105
4Log FlumeWater351,500110
5DodgemsFunfair10650130
6Big WheelFunfair1590090
7Pirate ShipAdventure301,100110
8Pedal BoatsWater540085
9CorkscrewAdventure501,700140
10Mini TrainKidsland1050085
11RocketSpace401,300130
12CarouselKidsland560085
13TeacupsFunfair1070095
14
G2

Ready for more?

The full lesson has 5 exercises, from easy to challenging, with hints, points and a streak you can build.

Start the lesson
← PreviousFiltering with a formulaNext →Combining

SQL

  • Topics
  • All lessons
  • Cheat sheet

Excel

  • Topics
  • All lessons
  • Shortcuts

HTML & CSS

  • About the course
  • All lessons

Lurndo

  • Dashboard
  • Leaderboard
  • Premium
  • Account
  • Privacy
Nederlands