by Allen Wyatt
(last updated April 6, 2018)
Zoran has a chart with eight XY (scatter) curves. For each curve he defined a plot order. When he adds a legend to the chart, the eight curves are listed in it. However, the order of those eight curves seems to be random. Zoran would like to change the order of entries in the chart legend, but can't find a way how to make such a change.
When you add a legend to a chart, the order in which the legend items appear is dictated by the order in which the data series are charted. For instance, let's suppose you have four data series referred to as North, South, East, and West. If the data series are plotted in this order, then that is the order in which they will appear in the legend from top to bottom (for legends positioned at the left or right of the chart) or from left to right (for legends positioned at the top or bottom of the chart).
The key, then, is to change the order in which your data series are plotted, and then Excel automatically changes the order in which they are displayed in the legend. (If you want the data series to be plotted in an order different from which they appear in the legend, Excel cannot handle that. The legend order is always tied to the data series order.)
To change the data series manually, try this little trick: click one of the data series in your chart. In the Formula bar, you should see something like this:
The SERIES function controls what is displayed for this particular data series (the one you selected by clicking). Notice that there are four parameters for the function. The first is the series name, the second is the X range, the third is the Y range, and the fourth is the order in which this particular data series is plotted. Change the fourth parameter and Excel immediately replots your data and updates the order in which items appear in the legend. When you change the parameter, the order parameter for all the other data series are automatically updated, as well.
Another way to change the order of the data series (and thus affect the legend) is to right-click any element of the chart (including the legend) to display a Context menu. Click the Select Data option and Excel displays the Select Data Source dialog box. (See Figure 1.)
Figure 1. The Select Data Source dialog box.
At the left side of the dialog box you see an area entitled "Legend Entries (Series)." This area details the data series being plotted. You can select one of the entries and use the up and down arrows (just to the right of the Remove button) to adjust the order in which the entries are plotted. When you click OK, the chart is replotted and the legend updated to reflect the plotting order.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (13214) applies to Microsoft Excel 2007, 2010, and 2013.
Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!
When you create a chart in Excel, the program may automatically add a legend that explains the contents of the chart. In ...Discover More
Need to move a chart legend to a different place on the chart? It's easy to do using the mouse, as described in this tip.Discover More
Displaying information using charts in Excel is easy and there are a variety of chart styles to choose from. Integrated ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.