# Excel/Dynamic chart

Question
Hi Tom

I have a worksheet (data) where I enter sales data from various territories on weekly basis

I then run various calculations on this data in another sheet (Calc) to work out various measures such as running total, average, etc....

I then have a sheet (inputs) where I enter the "Territory" and "Date From" & "Date To" criteria

What I want is then to use the calculations that just refer to the Territory & dates specified on the inputs sheet to become the source data for a chart.  This is the bit that I have a problem with.  What is the best way to pull this subset of data to act as a feed to the chart.  I cannot use a pivot chart because the chart is quite a complex visual.

Any help appreciated.

John

John,

If you have some rhyme or reason to the data that you want to gather together for the chart, then you would build a formula that keys off of a value you specify to pull the data together.

For instance if on the calculation sheet I have

North   data1B   data1C
North   data2B   data2C
North   data   data
West   data   data
West   data   data
West   data   data
East   data   data
North   data   data
West   data   data
East   data   data

on another sheet or in another location in the same sheet you could put the word North in say cell z100.  For simplicity, we will assume the above data and the formulas are all on the same sheet.

then in Z101 you could have

=if(\$Z\$100<>"",Vlookup(Z100,A:C,2,False),"")

so this would pull back the value in column B ("Data1B") of the sample data above.  But it would not be useful to pull back data from the next row.   You would need to use an array type formula to get all the North data
=INDEX(\$B:\$B,SMALL(IF(\$A\$1:\$A\$100=\$Z\$100,ROW(\$A\$1:\$A\$100)),ROW(\$A1)),1)
This would be entered with Ctrl+Shift+Enter rather than Enter since it is an array formula.

I could then be pulled down the column to pull back data from column B where North appears in column A of that row.

So this is an example.  Unfortunately you have only provided a very general description of what you are doing and where your data is located.  So what I propose is that you would need to build a source range for your graph.  You would set it up and populate it using formulas based on some value you specify.

For anything more specific, I would need to know a lot of details about what, where and so forth.

If you want to send a sample workbook with a detailed description of what you want to do I can try to give you a better answer (if there is one).

--
Regards,
Tom Ogilvy
Questioner's Rating
 Rating(1-10) Knowledgeability = 10 Clarity of Response = 10 Politeness = 10 Comment No Comment

This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

#### Tom Ogilvy

##### Expertise

Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]

##### Experience

Extensive experience.

Education/Credentials
Master of Science (MS) degree Operations Research (ORSA)

Awards and Honors
Microsoft MVP in Excel.