Close this search box.

Analyse Data like a Super Hero



In mid May, Anup47 asked a question in the Chandoo.org forums about the use of a VBA macro to run a number of iterations of a variable against two sets of X values, you can see the post here. It turns out that the number of iterations was 500 columns of data with each column having 27 values.

On examination of the problem, it was going to be a straight forward matter of setting up a statistical function Linest and then using the Data Table command to run each set of data through the function.

The Linest will take the input data and return the statistics that Anup wanted.

The Data Table function will feed in the source data and tabulate the Input and Output data.

This Post follows through a worked example which you can follow along, download the Sample file to suit Sample File 97/2003 or Sample File 2007/10 version. The Sample File contains a worked example of the completed model as well as a Practice Page of the original data. Download the Excel 95/2003 or 2007/10 version above.

Please note that the sample file only contains 14 sets of data as opposed to the 500 Anup47 wanted to process.


There are a few things that needed setting up before the work starts.

  • Headers
  • Linest Area
  • Link Area
  • Data Table Area

Once these areas are setup we simply use the Excel Data Table function.

Once the Data Table function has run, the results can be processed or analysed as required.


The original data was just that, a tabulation of raw data. The two X sets of Data were in Columns 1 & 2. Each Column from D onwards has a set of Y data that was to be processed.


The first thing that was required was some Headers for the Input Data.

This isn’t strictly required but it is good practice and makes it easier to tabulate and analyse results later.

Insert a Row above the first line

Put X1, X2 in A1, B1 and Y1 in D1 and then drag the lower right Black Handle across top to the right and Excel will autofill the remaining cells.

Linest Area

To get the statistics which Anup wanted we will use the Excel Linest function.

Linest is a Statistical Function that takes a set of data and compares it, in this case to two sets of X Values and produces a set of statistical measure relevant to the correlation between the data sets.

This post isn’t going to explain the intricacies of Linest and I refer you to the Links section at the end where you can read more about the Linest function at your leisure.

For our purposes we need to know that Linest is an Array Formula and requires a 5 Row x 5 Column area to be entered into. For now we will just Array Enter the function =Linest($D$2:$D$28,A2:B28,True,  True) into B32:F36.

To do that select the range B32:F36, Press F2 and type/paste the equation in, then Array Enter with Ctrl Shift Enter.

Link Area

To Link the Linest equation to a Data Table we need a link cell, which we will put just above the Linest area.

For now just enter a 1 in it.

We can now go back to the Linest area and link the Linest equation to our link area using the equation, =LINEST(OFFSET($C$2:$C$28,,$B$30),A2:B28,TRUE,  TRUE)

To do that select the range B32:F36, Press F2 and type/paste the equation in, then Array Enter with Ctrl Shift Enter.

What this does is allow the Linest formula to access different columns Y1 to Y500 depending on the value of the Link cell B30 which is now 1.

Data Table Area

To setup a Data Table area we need a column of Inputs which will be the Run Numbers and the Row Inputs will be links to the Input and Output Cells.

In a range J33:J46 put the values 1 to 14. These will be the Run Numbers. ie Run No 1, Run No 2 etc (Green in the example below).

Across the top of the Data Table area we can put a number of links and associated labels (Yellow and Blue)

In this case there are 4 Output links =B31, =C31, =B34 and =B33 and their associated labels above them, as well as 2 Input equations and there Labels. The Input equations are simple Offset function that retrieves a value from Rows 1 or 2 based on the value of the Link Cell B30.

These are technically not required but make data analysis and identification of individual results later on a lot simpler.

Run Data Table

We can now run the data Table by selecting the Data Table area: J32:P46

Noting that we will be using a Column Input cell and that it will link to $B$30, the Link cell for the Linest command.

What this does is takes the first value from the Column J32:J46 and puts it into B30, then the Linest command will be calculated and the results put into the Data Table area along with the Inputs.

This is repeated for each cell in J32:J46 automatically.

The final Data Table is now populated as below:

You can see by extending the Data Table input column from 14 to 500 that the full 500 columns of Input Data could easily be processed.


You now have a set-off data that can be analyzed using normal statistics, Min, Max, Std Deviation etc, or can be fed into a Pivot Table/Chart for analysis etc.


Linest References



Data Table References



How can the Data Table command help you become a data processing super hero?

How can the Data Table command help you become a data processing super hero?

Let us know in the comments below:


Share this tip with your colleagues

Excel and Power BI tips - Chandoo.org Newsletter

Get FREE Excel + Power BI Tips

Simple, fun and useful emails, once per week.

Learn & be awesome.

Welcome to Chandoo.org

Thank you so much for visiting. My aim is to make you awesome in Excel & Power BI. I do this by sharing videos, tips, examples and downloads on this website. There are more than 1,000 pages with all things Excel, Power BI, Dashboards & VBA here. Go ahead and spend few minutes to be AWESOME.

Read my storyFREE Excel tips book

Excel School made me great at work.

– Brenda

Excel formula list - 100+ examples and howto guide for you

From simple to complex, there is a formula for every occasion. Check out the list now.

Calendars, invoices, trackers and much more. All free, fun and fantastic.

Advanced Pivot Table tricks

Power Query, Data model, DAX, Filters, Slicers, Conditional formats and beautiful charts. It's all here.

Still on fence about Power BI? In this getting started guide, learn what is Power BI, how to get it and how to create your first report from scratch.

Announcing Power BI Dashboard Contest 2024

Announcing Power BI Dashboard Contest (win $500 prizes!)

Hey there, I have a SUPER exciting announcement! April is about to get a whole lot sweeter with our Power BI Dashboard Contest! Your mission, should you choose to accept it: Craft the most EPIC dashboard for the Awesome Chocolates CEO with sales & financial insights! Winners stand a chance to score up to $500 in Amazon Gift Cards, plus some serious bragging rights!

8 Responses to “Analyse Data like a Super Hero”

  1. Meedan says:

    Great - Learned Something New Today.

  2. vivek says:


    I have a historical data of particular company like 5 yrs daily closing price.
    I have to calculate GARCH and volatility that company could u pls help me


  3. Hui... says:


    I'm unfamiliar with GARCH
    But, Have a look at http://www.youtube.com/watch?v=KJbR0nRinD4

  4. Renato says:


    I have data for two analyst performing same taks in two diff columns. How do i get to know who is the better analyst.


  5. MP says:

    I want to learn to use multiple sheets (one for input) and second for modeling. When I am using data table, I got an error "Input cell is invalid" when I try to use a different sheet. i found the following on microsoft website. I am trying to link the cell and try again, but linking the cell is not clear to me beside =Sheet1!C3. This method does not work.


    Here is an example

    Sale rep salary is in column 1
    Net Profit is in column 2
    Row 1, column 2 net profit entry is a reference from other sheet.
    Using =Sheet1!C3
    $38.66 is =Sheet1!G13

    Sales Salary Net profit
    $38.33 60000 (<=== This is used =Sheet1!C3)
    40000 38.33295155
    45000 38.33295155
    50000 38.33295155
    55000 38.33295155
    60000 38.33295155
    65000 38.33295155
    70000 38.33295155
    75000 38.33295155
    80000 38.33295155

    As you can see the values generated by the table is identical. I am not sure what is going wrong and how to use this workaround?


    • MP says:

      In above example Row1, column 1 is empty (assumption, but alignment issue when posting).
      I am referring to $38.33 and 60,000 row.

      It's empty cell in column1, $38.33 in column2, and $60,000 (outside the table, column 3).

      In what-if analysis, column selection is $60,000.


  6. Christian says:

    Hi Chandoo/Hui
    The example above has columns as a variable. I'm trying something a little different.

    I'm working with a table trying to figure out a way to use linest() only with a select number of rows. The selection is based on a product. A bit like sumif(). I have plus 100.000 rows of data and a number of products.

    Is there a way/formula to select/filter the datainput to Linest based on the product without using VBA? (I guess I could use VBA to filter and copy the relevant data to a new sheet but I'm trying to avoid VBA in this context).

    Input are most welcome

Leave a Reply