stretch line chart to same length in excel - excel

I have two series with data points in excel.
The data looks like this:
If I create a simple line chart it looks like this:
However, I would need the red line to be of the same length as the blue line since the data of both series stretches over the same time. Unfortunately I dont have the timestamps of each data point. But I guess there must be another way to do this.
It should be something like stretch the line over the whole x-axis of the graph.

If you have start and end timestamps for both, you can fill empty places with
=#N/A
That is, the not available error.
If you do not have the end/start timestamps for either, you will need to calculate them yourself.
Picture:

Related

Show graph without label, possible?

I have a macro that produces graphs like this:
The data for the graphs looks like (100,0,0,94,0,132,0,126,115) and so on.
The dotted graph shows all the data (note the dots on the "floor", that's data with value 0). The lines connects the dots with values more than 0.
I have to do this using two graphs and it works but it's a bit messy at the bottom as two labels show for each color. The example above works ok but if you want to see more lines it gets really messy quick and hard to see. Is it possible to only show the dotted graph in the graph window but not the corresponding label? Basically I want one label per color at the bottom.
And yes, I know there's a graph with dots and lines but it doesn't work for me.
Since the data looks like (100,0,0,94,0,132,0,126,115) the lines looks like sawtooths going all the way back to 0 and then back up again. I want the lines to only show the data with value more than zero.
In your case, the simplest way would be to substitute all 0 values with =NA() function. Excel won't chart #N/A! values. You'll still see the category label in the axis, but Excel won't chart the actual zeros.

Adding trend line in excel charts

I have a data series as below
I need a graph with trend line.
But in excel there is only some standard options available such as 'Moving Average' trend line as below.
I need something like this and not the average
So I did the following way. First I duplicated the series as below.
Then I used a 'Combo' chart type to get as below
This time I got the same way that I want. But issue is, data table showing duplicate values which I don't want.
Does anyone know how to solve this?

Excel sunburst chart format VBA

I'm trying to format the "segments" of a sunburst chart. The chart has one series and many points.
I can format the entire series like this:
With ActiveChart
.FullSeriesCollection(1).Format.Fill.ForeColor.ObjectThemeColor = msoThemeColorAccent1
End With
and i can format an individual point like this:
With ActiveChart
.FullSeriesCollection(1).points(1).Format.Fill.ForeColor.ObjectThemeColor = msoThemeColorAccent1
End With
but i can not figure out how many points there are in each "segment" so i can format them all the same. For example, the 5th point is in the second "segment" but i can't see a way to determine that.
By "segment" i mean all the points in that wedge of the pie from the centre out.
I was recently struggling with this kind of chart, too (see here). Sunburst charts are indeed very poorly documented.
My solution to the same problem was to go through the underlying data in order to get to know how many data points there are per column. Example:
The first category with result 50% has 3 out of 5 data points, which means the innermost point has index 1, while the index of the innermost data point of the second category is 4. Third one index 6, fourth 7 and so on. Knowing this index you can color the columns as you wish.
So answering your question: Using the sunburst chart, you have to know how many data points you have per column, (as far as I could find out) you can not figure this out by going through the data points themselves.

Add line to Scatter Plot

I did a scatterplot with two data series (blue and orange in the picture).
The orange line you see that connects the dots I did manually and I am looking for a way to have this automatic through the chart menu in Excel. Any idea who this can be done?
I am using Excel version 2013
The chart type you are trying to create is called a Step Chart. Unfortunately Excel doesn't natively offer this chart type, but there are several ways to fake them in Excel. You can use an XY chart with Error Bars to produce the horizontal lines, or you can use a column chart with extra in-between data points to fill the gaps between your actual data points, and you can probably also use another hack where you tell Excel that the x axis is a date axis.
It's a bit hard to advise which approach would suit you best without knowing whether your actual data matches the example you've posted or whether it differs in some way. If you can elaborate further I'll amend this answer with some examples.
Edit: Since your data is as described, you should be able to use the approaches outlined at https://peltiertech.com/Excel/ChartsHowTo/StepChart.html
Or alternately, just add in extra coordinates to direct Excel where to draw the line:
...and then delete the markers of the data points you want to hide:

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.

Resources