Home

Adding variable in chart series formula

%3CLINGO-SUB%20id%3D%22lingo-sub-843254%22%20slang%3D%22en-US%22%3EAdding%20variable%20in%20chart%20series%20formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-843254%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI've%20created%20a%20spreadsheet%20which%20tracks%20monthly%20sales%20of%20each%20of%20the%2040%20products%20I%20sell%2C%20and%20have%20created%20line%20charts%20for%20each%20product%20showing%20sales%20by%20month.%3C%2FP%3E%3CP%3EEach%20month%20I%20add%20a%20column%20to%20the%20right%20of%20the%20last%20data%20column%20and%20add%20the%20new%20month%20sales.%3C%2FP%3E%3CP%3EIs%20it%20possible%20to%20add%20a%20variable%20in%20the%20chart%20series%20formula%20where%20the%20variable%20refers%20to%20a%20specific%20reference%20cell%2C%20so%20I%20can%20just%20change%20the%20value%20in%20the%20cell%20and%20all%20the%20charts%20will%20automatically%20update%3F%20At%20the%20moment%20I%20manually%20edit%20each%20series%20formula%20in%20each%20chart%20with%20the%20latest%20column%20reference.%3C%2FP%3E%3CP%3EFor%20example%2C%20let's%20take%20the%20chart%20series%20formula%3C%2FP%3E%3CP%3E%3DSERIES(Data!%24F%24101%2CData!%24L%2479%3A%24BZ%2479%2CData!%24L%24101%3A%24BZ%24101%2C4)%3C%2FP%3E%3CP%3Ewhere%20my%20last%20column%20of%20sales%20data%20is%20BZ.%3C%2FP%3E%3CP%3EI%20then%20add%20the%20latest%20month's%20sales%20data%20in%20column%20CA.%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20I%20would%20ideally%20like%20is....%20in%20the%20reference%20cell%20(A1%20for%20example)%20I%20change%20the%20input%20from%20%22BZ%22%20to%20%22CA%22%20and%20this%20(somehow!)%20automatically%20updates%20all%20%22BZ%22%20references%20in%20all%20the%20chart%20series%20formula%20to%20%22CA%22.%20So%20the%20formula%20above%20becomes%20%3DSERIES(Data!%24F%24101%2CData!%24L%2479%3A%24CA%2479%2CData!%24L%24101%3A%24CA%24101%2C4)%3C%2FP%3E%3CP%3EThanks%20for%20any%20help%20in%20advance.%3C%2FP%3E%3CP%3EHuw%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-843254%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ECharting%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-843334%22%20slang%3D%22en-US%22%3ERe%3A%20Adding%20variable%20in%20chart%20series%20formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-843334%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403768%22%20target%3D%22_blank%22%3E%40huw_jones%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOther%20workaround%20would%20be%2C%20convert%20your%20Data%20into%20an%20%3CSTRONG%3EExcel%20Table%3C%2FSTRONG%3Eand%20then%20insert%20the%20Chart%20based%20on%20the%20Table%20data%20itself%20so%20that%20next%20time%20when%20you%20add%20another%20month%20column%20in%20the%20Table%20for%20the%20next%20month%20or%20you%20add%20more%20data%20down%20the%20rows%2C%20the%20Chart%20will%20be%20updated%20automatically.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20convert%20your%20data%20into%20an%20Excel%20Table%2C%20select%20all%20your%20data%20including%20headers%20and%20press%20the%20shortcut%20key%20%3CSTRONG%3ECtrl%2BT%3C%2FSTRONG%3Eand%20make%20sure%20that%20the%20CheckBox%20which%20says%20%22%3CSTRONG%3EMy%20table%20has%20headers%3C%2FSTRONG%3E%22%20is%20checked%20in%20the%20next%20window%20which%20pops%20up%20next%20and%20click%20OK%20to%20finish.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-843319%22%20slang%3D%22en-US%22%3ERe%3A%20Adding%20variable%20in%20chart%20series%20formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-843319%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403768%22%20target%3D%22_blank%22%3E%40huw_jones%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3EIf%20your%20goal%20was%20just%20to%20have%20the%20source%20data%20for%20the%20chart%20to%20expand%20and%20include%20newly%20added%20rows%20or%20columns%20then%20just%20convert%20the%20source%20list%20to%20a%20table.%20There%20are%20so%20many%20ways%20of%20converting%20a%20List%20to%20a%20Table%20(Auto-expandable)%20the%20easiest%20is%20by%20using%20the%20shortcut%20%3CSTRONG%3ECTRL%20%2B%20L%20or%20CTRL%20%2B%20T.%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EHowever%2C%20my%20understanding%20is%20you%20have%20a%20chart%20for%20the%20different%20products%20(row%20labels)%20and%20you%20want%20to%20be%20able%20to%20pick%20up%20a%20Different%20Month%20(months%20are%20in%20column%20labels)%20and%20have%20the%20chart%20automatically%20reflect%20your%20selected%20column.%20then%2C%26nbsp%3Byour%20goal%20of%20dynamically%20changing%20the%20source%20data%20%3CFONT%20color%3D%22%23FF0000%22%3E%3CSTRONG%3EColumn%3C%2FSTRONG%3E%3C%2FFONT%3Efor%20a%20chart%20can%20be%20done%20in%202%20ways%3A%3C%2FP%3E%3COL%3E%3CLI%3E%3CSTRONG%3ECreating%20a%20preparation%20table%20using%20Index%20%26amp%3B%20Match%20functions%3C%2FSTRONG%3E%3C%2FLI%3E%3CLI%3E%3CSTRONG%3EUsing%20an%20Offset%20function%20to%20dynamically%20pick%20up%20the%20correct%20input%20range.%3C%2FSTRONG%3E%3C%2FLI%3E%3C%2FOL%3E%3CP%3EI%20have%20a%20preference%20in%20your%20situation%20to%20using%20an%20%3CSTRONG%3EOFFSET%3C%2FSTRONG%3Efunction.%3C%2FP%3E%3CP%3EBecause%20of%20the%20extensive%20details%20that%20cannot%20be%20demonstrated%20by%20writing%20the%20steps%2C%20here%20are%20%3CSTRONG%3E2%20detailed%20video%20tutorials%20I%20created%20one%20for%20each%20option%3C%2FSTRONG%3E.%20Please%20watch%20them%26nbsp%3B%20and%20let%20me%20know%20which%20method%20works%20best%20for%20your%20specific%20work%20situation.%3C%2FP%3E%3CP%3EBy%20the%20way%2C%20we%20use%20both%20techniques%20for%20creating%20Dynamic%20Dashboards.%3C%2FP%3E%3CP%3E%3CSTRONG%3ESwitching%20Charts%20using%20Index%20%26amp%3B%20Match%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DkhXUZKCfPuU%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DkhXUZKCfPuU%3C%2FA%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3ESwitching%20Charts%20Using%20an%20Offset%20Function%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D5cDSup6NgHs%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D5cDSup6NgHs%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHope%20that%20helps%3C%2FP%3E%3CP%3ENabil%20Mourad%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-847546%22%20slang%3D%22en-US%22%3ERe%3A%20Adding%20variable%20in%20chart%20series%20formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-847546%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403768%22%20target%3D%22_blank%22%3E%40huw_jones%3C%2FA%3E%26nbsp%3BOne%20option%20is%20to%20set%20up%20a%20chart%20that%20has%20a%20dynamic%20range%20that%20you%20can%20control%20by%20specifying%20which%20data%20is%20included%20in%20the%20chart.%20I%20wrote%20an%20article%20with%20detailed%20instructions%20for%20this%20at%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fwww.thinkoutsidetheslide.com%2Fhow-to-create-an-excel-chart-with-a-dynamic-range-that-you-select%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.thinkoutsidetheslide.com%2Fhow-to-create-an-excel-chart-with-a-dynamic-range-that-you-select%2F%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHope%20that%20helps.%3C%2FP%3E%3C%2FLINGO-BODY%3E
huw_jones
Occasional Visitor

Hi,

I've created a spreadsheet which tracks monthly sales of each of the 40 products I sell, and have created line charts for each product showing sales by month.

Each month I add a column to the right of the last data column and add the new month sales.

Is it possible to add a variable in the chart series formula where the variable refers to a specific reference cell, so I can just change the value in the cell and all the charts will automatically update? At the moment I manually edit each series formula in each chart with the latest column reference.

For example, let's take the chart series formula

=SERIES(Data!$F$101,Data!$L$79:$BZ$79,Data!$L$101:$BZ$101,4)

where my last column of sales data is BZ.

I then add the latest month's sales data in column CA. 

What I would ideally like is.... in the reference cell (A1 for example) I change the input from "BZ" to "CA" and this (somehow!) automatically updates all "BZ" references in all the chart series formula to "CA". So the formula above becomes =SERIES(Data!$F$101,Data!$L$79:$CA$79,Data!$L$101:$CA$101,4)

Thanks for any help in advance.

Huw

3 Replies

@huw_jones 

Hello,

If your goal was just to have the source data for the chart to expand and include newly added rows or columns then just convert the source list to a table. There are so many ways of converting a List to a Table (Auto-expandable) the easiest is by using the shortcut CTRL + L or CTRL + T.

However, my understanding is you have a chart for the different products (row labels) and you want to be able to pick up a Different Month (months are in column labels) and have the chart automatically reflect your selected column. then, your goal of dynamically changing the source data Column for a chart can be done in 2 ways:

  1. Creating a preparation table using Index & Match functions
  2. Using an Offset function to dynamically pick up the correct input range.

I have a preference in your situation to using an OFFSET function.

Because of the extensive details that cannot be demonstrated by writing the steps, here are 2 detailed video tutorials I created one for each option. Please watch them  and let me know which method works best for your specific work situation.

By the way, we use both techniques for creating Dynamic Dashboards.

Switching Charts using Index & Match

https://www.youtube.com/watch?v=khXUZKCfPuU

Switching Charts Using an Offset Function

https://www.youtube.com/watch?v=5cDSup6NgHs

 

Hope that helps

Nabil Mourad

Charts are great for visualizing data. But having too many charts in a single worksheet may be confusing. In this tutorial I show you how to create 12 charts and be able to switch charts by selecting different options from a drop list. I'll be using INDEX & MATCH functions to do that
We know that a chart uses source data. In this tutorial I show you how to use an OFFSET function to store multiple source ranges in a defined name. Since our Defined name is controlled by a Drop List, Changing our selection from the Drop List automatically changes our Chart. It's an amazing ...

@huw_jones 

Other workaround would be, convert your Data into an Excel Table and then insert the Chart based on the Table data itself so that next time when you add another month column in the Table for the next month or you add more data down the rows, the Chart will be updated automatically.

 

To convert your data into an Excel Table, select all your data including headers and press the shortcut key Ctrl+T and make sure that the CheckBox which says "My table has headers" is checked in the next window which pops up next and click OK to finish.

@huw_jones One option is to set up a chart that has a dynamic range that you can control by specifying which data is included in the chart. I wrote an article with detailed instructions for this at https://www.thinkoutsidetheslide.com/how-to-create-an-excel-chart-with-a-dynamic-range-that-you-sele....

 

Hope that helps.

Related Conversations
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies
Tabs and Dark Mode
cjc2112 in Discussions on
2 Replies
Early preview of Microsoft Edge group policies
Sean Lyndersay in Discussions on
65 Replies
*Updated 9/3* Syncing in Microsoft Edge Preview Channels
Elliot Kirk in Articles on
202 Replies