So I got Sheet1 with a table containing some data. To simplify let's say there's a column 'x' with some data and a column 'y' with some data. Every now and then more values are manually added to the table.
On Sheet2 I need Excel to automatically plot a graph only using the last 10 values in the table. So when more values are added the graph changes automatically to the new last 10 values. Is this possible?
Furthermore, let's say there's a third column 'z' that's always a constant value (for example to show some kind of a maximum for 'y' in the graph). How to make Excel automatically fill the cell with the number when the according 'x' and 'y' cells are filled? I know I could manually fill the 'z' column all the way down but I suspect that would screw up with plotting the last 10 values.
I'm using MS Excel 2013.
Thank you very much!
You'll need to create a chart using dynamic named ranges as the series data.
Start by setting up the data table with headings x, y and z.
Select x heading and click Insert > Table, make sure "My table has headers"
is checked then click OK
In column z, to set 20 as the autofilled value, add formula =20
Put your data in columns x and y
Create your chart based on columns x and y. This example creates a XY Plot.
Assuming you've only got one table in your workbook, it will be named "Table1".
Go to Formulas > Name Manager > New
xPlot: =OFFSET(Table1[[#Headers],[x]],COUNTA(Table1[z])-9,0,10,1)
Also create:
yPlot: =OFFSET(Table1[[#Headers],[y]],COUNTA(Table1[z])-9,0,10,1)
Right click on your chart and click Select Data...
Remove the Series that is there
Create a new Series
If your workbook was called Chart Example.xlsx, then set:
Series X values: 'Chart Example.xlsx'!xPlot
Series Y values: 'Chart Example.xlsx'!yPlot
Click OK and try adding more data.
Related
I have a line chart in excel with data already set; I need to add a vertical line that moves according to the X values (month dates). For example for this month the line will move on the X value of "Jul-20"
Below I have attached the screenshot of the chart and the chart data. I have never had my hands on excel chart up until now and this chart has not been made by myself. Any help would be appreciated.
UPDATE 1
Thanks to #Steven Pomponio
when I try to add the new series for the vertical line, I do not have the "Y" values; see screenshot
UPDATE 2
added a new data source with values as 01/072020 and /01/07/2020 in cells J182 and K182; now I see a black dot on the left between the £10.0m and £ 20.0m Y values. If I change the verttical line data source chart type to be "Scatter with straight lines" then I do not even see the point.
If I change teh entire chart to be of Scatter with straight lines then I do see the Series Y Values but the whole chart change design and I do not want to do this.
UPDATE 3
Thanks to #Steven Pomponio I did it
Choose two cells in which you will have your target x value where the vertical line will appear, for this example I'll be using cells (E1) and (E2). Within cell (E1) you'll want to type in the formula =TODAY()-DAY(TODAY())+1 in order to get the first date of the current month. Cell (E2) can just be =E1.
In two cells, preferably next to them you will need to enter in the minimum and maximum bounds of one of your axes (Since you are already using a dual axes). It is important that these numbers are the same as what you set for the axis min & max bounds as this allows for you the line to properly span across the entire chart. Don't leave them on Auto.
Next, right click on your chart and click Select Data -> Add -> and add in the two dates (cells (E1) and (E2)) into the Series X Values, and the min and max bounds into the Series Y Values.
The final step is to make sure that the Chart type for this newly added series is selected as Scatter with Straight Lines and plotted on whichever axis you set the bounds equal to.
I have this bar chart in excel :
As you see, if there is #'¡DIV/0!, the values are 0. What I really want is that the bar chart just shows the numeric values. In this case. just the first three values would have to be visualized. I tried the formula IF.ERROR(FORMULA,"") but the result was the same,
So, How Can I do that?
You need dynamic ranges for the chart, or filter the data source to hide the rows with the error. Excel charts will not include data that is hidden with a filter.
To apply dynamic ranges, create two range names with the following formulas:
chtLabels =OFFSET(chtValues,0,-1)
chtValues =Sheet1!$B$12:INDEX(Sheet1!$B:$B,MATCH(99^99,Sheet1!$B:$B,1))
Adjust the chtValues range name to start in the first cell with a number in column B instead of B12 of the example.
Edit the column chart series values and enter the range name, preceded by the sheet name, like
=Sheet1!chtValues
Edit the Horizontal axis labels and replace the range with the dynamic named range
=Sheet1!chtLabels
When you exit the dialog, Excel will replace the sheet name with the file name. The result will be similar to this:
Note how the series formula shows the range names instead of the cell ranges.
=IFERROR(value, value_if_error) where value_if_error should equal 0 or "" or whatever you want
I have a data something like below,
data set #1
A 1
B 2
C 3
A 10
B 20
C 30
A 50
B 60
C 70
It is not properly row-column formatted, so the generated chart is not as expected.
I know it will be easier if it is formatted like below.
data set #2
A 1 10 50
B 2 20 60
C 3 30 70
But how to generate a line chart for my data set #1 that should look similar to data set #2's chart?
[I have a huge set of data, it can't be transformed by hand]
here I explain how to make a pivot chart of your data, as suggested by #Riverside
lets label your data: put "label" in cell A2, "value" in cell B2
in your table, go to cell C3 and type the following formula: =COUNTIF($A$3:A3,A3)
drag the bottom right corner to auto-fill the rest of the rows. Lets call this column:"order" (put in cell C2)
now select cells A2:C11 and click on: insert -> pivot table -> pivot chart. Under "Choose where you want the PivotTable.." select the radio button which says: "Existing worksheet" and put E2 in the box. click ok.
in the pivot table Field list pannel on the right drag the "label" field from the top panel into "legend fields", "order" into "axis fields" and "value" into "values".
on the top left of the ribbon, click "change chart type" and select "line"
you can close the pivot table dialog boxes and style your chart as normal.
if you wish to hide the pivot table data, you can simply hide the columns it is in (select columns , right click, hide)
The data would have to be transformed to get a chart like data-set #2. For transformation you could either use pivot tables like #Riverside mentioned, or you could use some simple formulas. Check out this excel which does what you are trying to do.
All you have to do is paste your data, however large it may be, in the first two columns (A and B), and the data is instantly transformed into the 2D set. I've already defined a chart, so you only have to redefine the chart ranges by dragging.
In case the link for the file doesn't work, use this link (Dropbox). Note that if you view it on dropbox itself, some formulae don't work, so I'd suggest downloading and viewing.
Put two labels on top of your data.
Then select all data, select insert Line chart in your excel.
Excel automatic see your labels as labels and the rest as data. Your line chart should be fine now.
I'm trying to utilize the Range Names feature in Excel to create a chart that will automatically update once new data is appended. I've successfully done this with two variables (i.e. Date and Temperature) but I'm unable to get it working with 3 or more variables.
Within a tab titled, 'Dynamic', I have a Date (value in A1) column with these values: 4/1/2013, 4/2/2013, 4/3/2013, 4/4/2013, 4/5/2013 (Value in A6).
I also have a Temperature (value in B1) column with these values: 55, 60, 62, 65, 61 (Value in B6).
Within the Name Manager (within Formulas tab) I created a Named Range with a Name of "Date" and a Refers to value of:
=OFFSET(Dynamic!$A$2,0,0,COUNTA(Dynamic!$A:$A)-1)
I created another Named Range with a Name of "Temperatues" and a Refers to value of:
=OFFSET(Dynamic!$B$2,0,0,COUNTA(Dynamic!$B:$B)-1)
I then selected the range A1:B6 and inserted a Clustered Column chart. Clicking on one of the bars yields this formula:
=SERIES(Dynamic!$B$1,Dynamic!$A$2:$A$6,Dynamic!$B$2:$B$6,1)
If I insert my Named Ranges in the above formula like so:
=SERIES(Dynamic!$B$1,Dynamic!Date,Dynamic!Temperatures,1)
and it will allow me to add a new row of data and it automatically updates the chart.
This is great! But when I attempt to add another variable I can't get it to work. I add Rainfall (value in C1) to the spreadsheet with these values: 1, 2, 0.5, 0, 1. I create a Name Range with a Name of "Rainfall" and a Refers to value of:
=OFFSET(Dynamic!$C$2,0,0,COUNTA(Dynamic!$C:$C)-1)
I then select A1:C6, insert a Clustered Column chart. Clicking on one of the Temperature bars I change the formula to:
=SERIES(Dynamic!$B$1,Dynamic!Date,Dynamic!Temperatures,1)
When I attempt to change the formula for the Rainfall bars I try this:
=SERIES(Dynamic!$C$1,Dynamic!Date,Dynamic!Rainfall,2)
but when I hit enter it won't do anything. So, I'm left with a chart that won't update automatically.
Assuming I could get this to work, I'd like to move the Rainfall data onto a secondary axis and change the chart type to a line chart (so that it all fits nicely onto the same chart area).
Can you tell me what I need to do to get this example to work? Thank you!
I couldn't get this to work either, using the SERIES formula. Then again, I suppose it is considered an undocumented feature.
However, if you edit using the Select Data dialog then it works.
I have a client that has a simple yet complicated request for an excel sheet setup, and I can't for the world thing of where to start. I'm drawing a blank.
We have a data range. Example:
Quarter Data
2010Q1 1
2010Q2 3
2010Q3 4
2010Q4 1
I have a chart built on top of that. Change data, chart changes, protect worksheet to keep other idi... er... users from changing old data. Simple.
What I want to have happen: When I add the next Q1 below Q4, the chart "automagically" selects the most recent 4Q. So when I update the data to:
Quarter Data
2010Q1 1
2010Q2 3
2010Q3 4
2010Q4 1
2011Q1 7
The chart will show data for the last 4 quarters (2010Q2 thru 2011Q1). The goal being: keep "old" data on the same sheet, but have the charts update to most recent quarters.
I'm thinking: "fixed" data locations, reverse the data (new data at top), and just insert row each new quarter:
Quarter Data
2011Q2 9
2011Q1 7
2010Q4 1
2010Q3 4
2010Q2 3
2010Q1 1
But this will involve a lot of changes to the already existing excel sheets and I was hoping that there may be an easier/better "fix".
EDIT:
#Lance Roberts ~ Running with your suggestion:
- Little more detail... The data is setup such that the column information is in A, but data for multiple tables are in B+. Table 1 is B/C. Table2 is D/E. Etc.
- Data is also on a different sheet than the tables.
Going by: This Offset Description, what I've tried doing is adjusting similar to such:
NAME FORMULA OFFSET(range, rows, columns, height, width )
DATA0 =OFFSET('DATASHEET'!$A$2, COUNTA('DATASHEET'!$A:$A - 8, 0, 8, 1)
DATA1 =OFFSET('DATASHEET'!$A$2, COUNTA('DATASHEET'!$A:$A - 8, 1, 8, 1)
DATA2 =OFFSET('DATASHEET'!$A$2, COUNTA('DATASHEET'!$A:$A - 8, 2, 8, 1)
Goal being to tie the length/location for B/C/etc data to A. So if I add a column on A, stuff tied to Data1/2 adjust accordingly (or 3/4/5/etc, which are different charts on different sheets
)
I want data cells to be picked by the first row, and then an offset number to get data x columns over. Variations on the formula don't seem to be working.
1 issue I haven't solved yet: the data is not aligning properly:
"Data" is always, last column under 2nd to last Quarter. Last quarter is always empty. Data is shifting to the right (in this example, under 3Q10 - NOT under the correct column. 11 should be under 4Q10. 9.5 should be under 2Q10).
I know I'm getting something simple wrong...
Seems to be working. First thing I had to change was CountA - 9 (not CountA - 8). Next was the "column offset" (0, 1, 2, 3,...). Also split some stuff up to make it more compartmentalized (I do have to train someone else how to do this for her reporting needs).
Thanks Lance :)
If the chart is on the same sheet as the data:
Name the first cell of the data (A2) as a named range, say TESTRANGE.
Created a named range MYDATA as the following formula:
=OFFSET(TESTRANGE, COUNTA($A:$A) - 5, 0, 4, 2)
Now, go to the SERIES tab of the chart SOURCE DATA dialog, and change your VALUES statement to:
=Sheet1!MYDATA
Now everytime you add a new row, it'll change the chart.
I know this is an old question, but I wanted to share an alternative that may be easier.
Change your Quarter-Data range to an Excel Table. Select the range, and press Ctrl+T. In the Insert Table, make sure the correct data range is selected, and that My Table Has Headers is checked, and press OK. This converts the simple range into a special data structure with magical properties.
Then make a new range which links to the last four rows of this table, and create a chart based on this new range. This is illustrated below. The table is the specially formatted range in A1:B9 (you can choose a less in-your-face style), and the plotting range is D1:E5.
The formulas in cells D2 through D5 are below. Copy D2:D5 and paste into E2:E5 to complete the formulas in our plotting range.
D2: =INDEX(Table1[Quarter],ROWS(Table1[Quarter])-3)
D3: =INDEX(Table1[Quarter],ROWS(Table1[Quarter])-2)
D4: =INDEX(Table1[Quarter],ROWS(Table1[Quarter])-1)
D5: =INDEX(Table1[Quarter],ROWS(Table1[Quarter]))
Table1 is the name assigned to the Table, and Quarter is the name of the first column of the Table (and also the column header). You don't need to type all this, just select the column in the Table. As the Table expands or contracts, Table1[Quarter] keeps track of the changes.
Now add a new data point. The Table expands, and our little staging area in D1:E5 links to the new last four rows of the table.
And as we add years worth of data, the formulas and the chart keep up.