Dynamic number of series in Excel Scatter Plot - excel

I have a data set (2 tables see first screenshot below) which dynamically update both by the rows and columns - and used that to plot XY Scatter, (x values are pulled by the table above, and y values from the table below).
There are 18 series in all, i.e. devices starting from CPAP to X-Ray Machine.
Each series has a dynamic range using the OFFSET function and hence that updating does not give an error on the chart - BUT because the devices itself are dynamic, they can either be only 1 series or all 18 series. When that updates, it results an error on the scatter plot. (see 2nd screenshot).
As you can see from the 2nd screenshot, the series become blanks and returns an error. I want the chart to reflect only that series that are not blanks.
I have a basic understanding of VBA, and so couldnt figure out how to code that functionality in the chart based on the searches I made to find a solution. Would appreciate if someone can help me figure this code!
edit:
Attached is a screenshot with just one device selection (i.e. Pulse Oximeter).
The formula for X values is:
=OFFSET(TDI!$B$12,0,0,1,COUNT(TDI!$12:$12)-1)
and for Y values:
=OFFSET(TDI!$B$36,0,0,1,COUNT(TDI!$36:$36))

Related

Prevent Excel from changing x-axis on a dynamic chart

I wanted to make a dynamic chart that plots out the graph of a standard curve for a bio assay we perform frequently. Often to boost the fit of the curve you may drop one or two data points on either end of the data set. So using vlookups and if statements I have a scheme that performs that data trimming, such that my data always starts in Row 1 and the column length simply shortens.
My table works great, but my xy scatter chart goes bananas on these changes. I have the plot on a log log scale, which looks fine if the full data set is present. I lose the x axis detail when I perform a trim. The x- axis then resets to range of 1 to length of my data set.
How can I prevent this?
UPDATE
I added some information. I know there are VBA ways to do this but I would prefer to keep the spreadsheet as simple as possible. I would think excel should be able to handle this.
So if I have a bad fit I may want to trim the data series either from the beginning or end of the data set. I accomplish that with the spinner buttons to dynamically change the table but the following happens
My formula that updates the columns looks like the following. Its messy.
=IF(ISNA(IF(VLOOKUP(F6,$C$4:$D$11,2,FALSE)+1>8-($B$5-1),"",INDEX(C$4:C$11,VLOOKUP(F6,$C$4:$D$11,2,FALSE)+1))),"",IF(VLOOKUP(F6,$C$4:$D$11,2,FALSE)+1>8-($B$5-1),"",INDEX(C$4:C$11,VLOOKUP(F6,$C$4:$D$11,2,FALSE)+1)))
In the formulas use NA() instead of "". Filling cell with "" does not result in a true empty cell and is the reason why you are experiencing issues with your chart.
Hope that helps.
I may be missing the obvious here, but just hard-code the graph with a range of your choosing. In the sample screenshot, making the graph auto defaults the max range to 100,000. I went in and hard-coded the maximum to 50,000 (circled). Afterwards, the 5th data point is not displayed in the chart. Doesn't matter what the data shows at this point.

Excel scatterplot graph update automatically

My problem is as follows:
The user inputs two numbers between 2 and 25, these numbers are used to create a grid. Every point on the grid has (x,y) coordinates. Based on the amount of points the user chose, my excel sheet is filled up with up to 25x25 (x,y) coordinates.
Example: A 6x7 grid is chosen by the user, the table is filled with 42 (x,y) coordinates and all other values in the table are set to "".
Now I want to use a scatterplot with lines connecting each array to plot the data.
Problem 1: If I only select the 6x7 part of the table that has values in it and create the scatterplot the result is correct. Until the user specifies a different grid, for example 8x9, then the graph is obviously missing two rows and two columns of input data.
Problem 2: If I select the entire 25x25 part of the table, including all the "" values, the graph axes get messed up. The y-axis works properly, but the x-axis shows sequential values (0-7) instead of the x-coordinates.
Problem 3: If I replace all the "" values in the table to 0 or NaN and plot the entire table the axes are correct, but the lines between the scatter data get messed up.
Question:
Is there a way to automatically change the input data for the plot, or is there a way to correctly display the values on the x-axis if I select all the data?
Not sure this will work in your case, but it's worth a try, especially since no one's addressed your post in 3+ hours. I've had success with this approach: 1) charting the largest data set, 2) copying the resulting chart, and 3) trimming the data it draws from to produce all smaller data sets.
To get this to work takes a lot of thought in laying out that largest data set so that all the other plots follow as needed. To illustrate, I've somewhat mimicked your data and in the animated gif I show largest data set, plus 2 others produced by copying it. Then I demonstrate how to make the second one, including the rescaling required to make all plots scaled equally. Notice that I've arranged things so that only one set of x-values feeds all the series. If you can do this, it makes working with the Excel's interface much easier.
After wrestling with it all night I came to the following solution:
Instead of setting all the empty cells to "" or zero the cells should be be set to #N/A (not available). The graph properly ignores the #N/A cells exactly like I want it to and updates when values are entered into them.

Step-chart in Excel

I am trying to create step-chart in Excel using tutorial (section "Step Chart Approach 2: Line Chart with Repeated Ranges").
However, it works incorrectly.
According to instructions (section "How it Works") values from 2 named ranges should be shuffled, while I get consequent values from 2 ranges.
The resulting Series formula seems to be correct:
=SERIES(Sheet1!$B$59,('Book1.xlsx'!KPInames2,'Book1.xlsx'!KPInames),('Book1.xlsx'!reqKPI2,'Book1.xlsx'!reqKPI),1)
(I am using namedRange2 instead of namedRangeX)
What am I doing wrong? How to force excel to mix values from 2 ranges?
The problem was really in category axis insted of required dates axis.
So the solution is to create a series with dates axis insted of needed category axis. And afterwards to create dummy invisible category series on the secondary axis.
Finally, playing with axis placement and visibility will produce required result

Multiple axis line chart in excel

I'm looking for a multiple axis line chart similar to the one in the image below, (which is a javascript chart made by amcharts).
Does excel have an option to draw charts line these? Note there are 3 Y axes, and 3 line charts allowing you to compare data.
Is it possible to get more than 3 data points, each with unique axis on one chart ?
It is possible to get both the primary and secondary axes on one side of the chart by designating the secondary axis for one of the series.
To get the primary axis on the right side with the secondary axis, you need to set to "High" the Axis Labels option in the Format Axis dialog box for the primary axis.
To get the secondary axis on the left side with the primary axis, you need to set to "Low" the Axis Labels option in the Format Axis dialog box for the secondary axis.
I know of no way to get a third set of axis labels on a single chart. You could fake in axis labels & ticks with text boxes and lines, but it would be hard to get everything aligned correctly.
The more feasible route is that suggested by zx8754: Create a second chart, turning off titles, left axes, etc. and lay it over the first chart. See my very crude mockup which hasn't been fine-tuned yet.
The picture you showd in the question is actually a chart made using JavaScript. It is actually very easy to plot multi-axis chart using JavaScript with the help of 3rd party libraries like HighChart.js or D3.js. Here I propose to use the Funfun Excel add-in which allows you to use JavaScript directly in Excel so you could plot chart like you've showed easily in Excel. Here I made an example using Funfun in Excel.
You could see in this chart you have one axis of Rainfall at the left side while two axis of Temperature and Sea-pressure level at the right side. This is also a combination of line chart and bar chart for different datasets. In this example, with the help of the Funfun add-in, I used HighChart.js to plot this chart.
Funfun also has an online editor in which you could test your JavaScript code with you data. You could check the detailed code of this example on the link below.
https://www.funfun.io/1/#/edit/5a43b416b848f771fbcdee2c
Edit: The content on the previous link has been changed so I posted a
new link here. The link below is the original link
https://www.funfun.io/1/#/edit/5a55dc978dfd67466879eb24
If you are satisfied with the result you achieved in the online editor, you could easily load the result into you Excel using the URL above. Of couse first you need to insert the Funfun add-in from Insert - My add-ins. Here are some screenshots showing how you could do this.
Disclosure: I'm a developer of Funfun
There is a way of displaying 3 Y axis see here.
Excel supports Secondary Axis, i.e. only 2 Y axis. Other way would be to chart the 3rd one separately, and overlay on top of the main chart.
An alternative is to normalize the data. Below are three sets of data with widely varying ranges. In the top chart you can see the variation in one series clearly, in another not so clearly, and the third not at all.
In the second range, I have adjusted the series names to include the data range, using this formula in cell C15 and copying it to D15:E15
=C2&" ("&MIN(C3:C9)&" to "&MAX(C3:C9)&")"
I have normalized the values in the data range using this formula in C15 and copying it to the entire range C16:E22
=100*(C3-MIN(C$3:C$9))/(MAX(C$3:C$9)-MIN(C$3:C$9))
In the second chart, you can see a pattern: all series have a low in January, rising to a high in March, and dropping to medium-low value in June or July.
You can modify the normalizing formula however you need:
=100*C3/MAX(C$3:C$9)
=C3/MAX(C$3:C$9)
=(C3-AVERAGE(C$3:C$9))/STDEV(C$3:C$9)
etc.
Taking the answer above as guidance;
I made an extra graph for "hours worked by month", then copy/special-pasted it as a 'linked picture' for use under my other graphs. in other words, I copy pasted my existing graphs over the linked picture made from my new graph with the new axis.. And because it is a linked picture it always updates.
Make it easy on yourself though, make sure you copy an existing graph to build your 'picture' graph - then delete the series or change the data source to what you need as an extra axis. That way you won't have to mess around resizing.
The results were not too bad considering what I wanted to achieve; basically a list of incident frequency bar graph, with a performance tread line, and then a solid 'backdrop' of hours worked.
Thanks to the guy above for the idea!
Best and Free ( maybe only) solution for this is google sheets.
i don't know whether it plots as u expected or not but certainly you can draw multiple axes.
Regards
keerthan

Excel - self adjusting chart marker

I have a series of line graphs in excel that is data over time.
There are several date milestones in the chart (I.E. Nov 24th: Black Friday)
On the chart I'm trying to put in an arrow on the chart with the label over the chart near the date. (See attached, below)
The problem is that these are manually added and as I expand the data in the chart (add another month of data) the chart compresses and my milestone markers have to all be hand repositioned.
How can I do these milestone markers so that I don't have to hand edit the table every time I expand the chart? A sample chart with a column for the desired labels can be found at this link.
As an added note, I'm using Office (Excel) 11 for Mac.
is it possible to use data labels for the milestones? There is a nice article about using a formula to make a custom data label:
http://chandoo.org/wp/2010/05/05/change-data-labels-in-charts/
Make your arrow and label outside the chart. Plot a new series with one point, with X corresponding to the date and Y determined appropriately (as I'll describe in a moment).
Copy the shapes you want to use as a milestone, select the point you added above, and paste (Ctrl+V).
Now adjust the Y value for this point so the milestone is where you want it.
This tutorial shows a similar approach:
Use an Arrow to Indicate Special Points

Resources