Excel Scroll and Sort Table

Mynda Treacy

June 13, 2023

Dashboards have limited space which is why an Excel scroll and sort table is super handy.

Scroll and sort tables allow you to embed an extract of data from a larger table in your Dashboard.

Users can scroll to see all the records and toggle which column to sort by and set the sort order, as shown below:

Excel scroll and sort table


Subscribe YouTube

Download Workbook

Enter your email address below to download the sample workbook.

By submitting your email address you agree that we can email you our Excel newsletter.

Note, this workbook contains functions that are only available to Excel 2021 and 365 users.

Creating an Excel Scroll and Sort Table

Before we had the luxury of Dynamic Arrays, creating an Excel scroll and sort table was a complex task.

It required multiple tables, formulas and helper columns, which I cover in detail in my Excel Dashboard course.

But in this tutorial I want to show you how simple it is to create a scroll and sort table using the new Dynamic Array functions and functionality.

To be clear, the techniques in this tutorial will only work in Excel 2021 and 365 where you have the new Dynamic Array functions.

Source Data

My 20 rows of source data is stored in an Excel Table called ‘Stock’:

excel scroll and sort data source

Formatting your data in an Excel Table isn’t strictly necessary, but it makes it quick and easy to write my formulas using the Table’s Structured References.

Excel Scroll and Sort Table Form Controls

The sort column and sort order are controlled using Radio Buttons and I used a Scroll Bar for the scrolling of the table.

excel form controls

Radio Buttons and Scroll Bars are Form Controls that allow the user to interact with your worksheet.

Note: the up/down triangles are Symbols inserted in the cell.

Form Controls are found on the Developer tab:

excel developer tab

If you don’t see the Developer tab, read this article for instructions how to enable it: Enable the Developer Tab in Excel.

The selection made in a Form Control is returned to a cell that you specify by right-clicking on the Form Control > Format Control > Cell Link:

excel form control cell link

You can see the Form Control selection results in the image below where the Sort Order button is displayed in cell H3, the Sort By is in cell H4 and the scroll bar position is in cell H5.

These results can also be hidden on another sheet. I've included them beside the table so you can see them in context:

excel form control output

When you place the Radio Buttons inside a Group Box, like I’ve done above, each button is given a number.

For example, the first 'Order' Radio Button is selected and cell H3 contains 1. Likewise, the second 'Sort By' Radio Button is selected and cell H4 contains 2.

The Scroll Bar shows position 9 because it's scrolled almost to the bottom.

Tip: the whole Radio Button frame must be inside the Group Box for it to form part of the group. If the outer edge of the Radio Button is outside the Group Box, it won’t be included.

excel form control alignment

Excel Scroll and Sort Table Formula

The table contains a single formula that detects the selections made in the Form Controls and returns an extract of the source data accordingly.

It uses the INDEX, SORT, CHOOSE and SEQUENCE functions. They are linked to named cells for Order (H3), Sortby (H4) and Scroll (H5):

=INDEX( SORT(Stock, SortBy, CHOOSE(Order,1,-1)), SEQUENCE(10,1,Scroll+1,1), {1,2,3,4,5})

In English it reads:

  • SORT the tabled called Stock by the 'Sort By' column number displayed in cell H4 named SortBy,
  • use CHOOSE* to return 1 for ascending and -1 for descending based on the order specified in cell H3 named Order,
  • INDEX the table returned by SORT,
  • returning 10 rows starting at the row number in cell H5 named Scroll +1 and increment by 1,
  • and return columns 1 through 5.

And because it’s a dynamic array formula it spills the results to create a table 10 rows high and 5 columns wide:

Excel Scroll and Sort Table formula

*The SORT function requires 1 for ascending order and -1 for descending order.

The Radio buttons return 1 for ascending and 2 for descending, so we use CHOOSE to return the correct value for the SORT function.

Alternatively you could use SWITCH(Order,1,1,2,-1) to achieve the same result.

Conditional Formatting

The final touch is to add a conditional formatting formula to highlight the selected ‘Sort by’ column.

excel conditional formatting

Related Tutorials

I realise that you may not have access to dynamic array functions yet, but there are many other ways you can use Form Controls in earlier versions of Excel.

Below are a few tutorials you might like to check out:

Form Controls

Toggle Conditional Formatting On and Off using Form Controls

Interactive Excel Charts

Excel Chart Highlighting
 

Please Share

If you liked this please share this tutorial with your friends and colleagues.

AUTHOR Mynda Treacy Co-Founder / Owner at My Online Training Hub

CIMA qualified Accountant with over 25 years experience in roles such as Global IT Financial Controller for investment banking firms Barclays Capital and NatWest Markets.

Mynda has been awarded Microsoft MVP status every year since 2014 for her expertise and contributions to educating people about Microsoft Excel.

Mynda teaches several courses here at MOTH including Excel Expert, Excel Dashboards, Power BI, Power Query and Power Pivot.

15 thoughts on “Excel Scroll and Sort Table”

  1. Hi Mynda,

    My table is similar but is most text data and one column displaying date & time (06/01/2025 21:00). The first column is Months, when sorting High to low (Order) it doesnt appear to be in a logical sequence, this work fine for project name and change name. However whenever I sort any of the comments Low to High I get “VALUE!”.

    The custom column is my main priority, this is when any of the information for each line was last updated and really want to be able to sort this from oldest to newest.

    Can you help?

    Reply
  2. Hi Mynda,
    this is a great tool.. thanks.. My excell skills are very limited, and I would like to use this template in various scenarios, I presume that I can populate the “stock” table with my data which may be more than 20 items?

    Reply
    • Yes, you can modify the stock table for your needs. You’ll need to modify the scroll bar maximum to suit the size of your data.

      Reply
  3. Hi Mynda et al,
    this really is so clever and imginative!
    unfortunately I don’t have this functionality yet to have a play with; so please tell me this:

    why can’t you use another SEQUENCE in the INDEX function instead of {1,2,3,4,5,6} for the column refs?

    I might have used 3-2*$I$3 instead of the CHOOSE function, but there’s no effective difference

    jim

    Reply
  4. This is a great lesson/tool. I have used these methods in creating a summary report with several KPIs to the upper management (for a client). They were very impressed (wow factor !!) and went on to use the report for their management meetings! It was a little tricky to get set up initially (before dynamic arrays) but well worth the effort. Excellent!

    Reply
    • Hi Søren,
      As noted in the article,
      “At the time of writing Dynamic Arrays are only available in Office 365 and are currently in beta on the Insiders channel. We don’t have an ETA for when they will be available to all Office 365 users yet.”
      If a function is not available in your excel version, it will receive that prefix: _xlfn

      Reply
    • Hi Søren,

      As Catalin mentioned, the xlfn prefix is inserted when you don’t have the function in your version of Excel.

      The INDEX & MATCH formula you provided wont’ respond to changes in the sort order or sort by column. This is where the new SORT and SEQUENCE functions come into play.

      Mynda

      Reply
  5. Hi Mynda

    Absolutely superb use of the new Dynamic Array functionality to show a sorted subset of your data on a dashboard.
    I love your clever use of the form controls to change Sort direction and Sort column and the use of the Slider bar for determining the start position.
    This will be useful for a lot of people.
    Thanks for sharing.

    Reply

Leave a Comment

Current ye@r *