Ignore cells on Excel line graph - excel

I am trying to draw a line graph in Excel 2010. The y column data source has some gaps in it and I want these to be ignored for the graph. Seems to default these to zero. I know the "Hidden and Empty Cell Settings" exists, but this is only giving the option to set it to zero. Any other way to get my graph looking the way I want it
Image available once I have enough reputation!

if the data is the result of a formula, then it will never be empty (even if you set it to ""), as having a formula is not the same as an empty cell
There are 2 methods, depending on how static the data is.
The easiest fix is to clear the cells that return empty strings, but that means you will have to fix things if data changes
the other fix involves a little editing of the formula, so instead of setting it equal to "", you set it equal to NA().
For example, if you have =IF(A1=0,"",B1/A1), you would change that to =IF(A1=0,NA(),B1/A1).
This will create the gaps you desire, and will also reflect updates to the data so you don't have to keep fixing it every time

In Excel 2007 you have the option to show empty cells as gaps, zero or connect data points with a line (I assume it's similar for Excel 2010):
If none of these are optimal and you have a "chunk" of data points (or even single ones) missing, you can group-and-hide them, which will remove them from the chart.
Before hiding:
After hiding:

In the value or values you want to separate, enter the =NA() formula. This will appear that the value is skipped but the preceding and following data points will be joined by the series line.
Enter the data you want to skip in the same location as the original (row or column) but add it as a new series. Add the new series to your chart.
Format the new data point to match the original series format (color, shape, etc.). It will appear as though the data point was just skipped in the original series but will still show on your chart if you want to label it or add a callout.

There are many cases in which gaps are desired in a chart.
I am currently trying to make a plot of flow rate in a heating system vs. the time of day. I have data for two months. I want to plot only vs. the time of day from 00:00 to 23:59, which causes lines to be drawn between 23:59 and 00:01 of the next day which extend across the chart and disturb the otherwise regular daily variation.
Using the NA() formula (in German NV()) causes Excel to ignore the cells, but instead the previous and following points are simply connected, which has the same problem with lines across the chart.
The only solution I have been able to find is to delete the formulas from the cells which should create the gaps.
Using an IF formula with "" as its value for the gaps makes Excel interpret the X-values as string labels (shudder) for the chart instead of numbers (and makes me swear about the people who wrote that requirement).

Not for blanks in the middle of a range, but this works for a complex chart from a start date until infinity (ie no need to adjust the chart's data source each time informatiom is added), without showing any lines for dates that have not yet been entered. As you add dates and data to the spreadsheet, the chart expands. Without it, the chart has a brain hemorrhage.
So, to count a complex range of conditions over an extended period of time but only if the date of the events is not blank :
=IF($B6<>"",(COUNTIF($O6:$O6,Q$5)),"") returns “#N/A” if there is no date in column B.
In other words, "count apples or oranges or whatever in column O (as determined by what is in Q5) but only if column B (the dates) is not blank". By returning “#N/A”, the chart will skip the "blank" rows (blank as in a zero value or rather "#N/A").
From that table of returned values you can make a chart from a date in the past to infinity

Related

Exclude '0' values from an Excel 2010 column chart

Is there any way to exclude values from a chart that are '0'? The data source is a mixture of vlookup's or sums where the results have a value others are '0'. When I plot the chart and there are some axis points with all '0' - can these be excluded to only show columns with data present?
Changing the source data to blank cells stills plots the data. There is an option on the line charts to join/connect empty cells but there is no function that I am aware of for a column chart.
Indeed it is:
Change your formula(s) to an if statement, so that it return NA() instead of 0. The chart won't show/include N/A values, however the label will be viable still as a standard. You may hide this label.
This method will work in this case if I understood your OP correctly. However, it may not work in all cases, as hiding 0-values from graphs may or may not require a different approach.

A variable chart axis depending on if data is present in the corresponding cell

I have a chart which contains Output in percent on the y axis and days of the week on the x axis. Some days, there may be no output if production is not running that day (some weekends but not all). This causes a dip in the chart as it jumps from some output value (lets say 90%) to 0% on a day when there was not production. When there was not production, I do not want the data to be recorded in the chart.
Is there a way through chart setup, cell formulas, or vba to format the chart axis to use only the days that contain output data?
There is a simple trick in excel to hide values in charts (not all charts but quite a few). If you use #N/A the chart can ignore these values (see my table 1). It creates "gaps" where the #N/A is located as default. But you could choose to treat #N/A's as "gap", "0" or "fill gap by connect lines".
If the cell is hidden (column or row is hidden) or filtered out... which I did on my second table, excel ignores these values. So for my second table I only filter values, while excluding all #N/A. I would treat those 0% as #N/A for graphical purpose (dummy column...)
Some extended reading can also be found here:
Display empty cells, null (#N/A) values, and hidden worksheet data in a chart

Is it possible to get an excel chart with possibility to select the graphs to display?

I have several data in excel sheet and I wonder if its possible (through macros or something else) to select the data and display the series needed.
I'm not quite sure if I explained the situation correctly...
But I have multiple curves, and instead of plot the average curve or single curves, I would like to have the option to plot: curve 1, curve 2, curve 3, average curve...
Kind regards,
DNA
My preferred way to do this is with a combination of a couple of ideas. In general, Excel charts are easiest to maintain if they are looking at a simple range instead of complicated named ranges. Given this, I like to create a simple column of data for the chart and then use other Excel features to modify that column of data.
Note that the steps below are for a specific case of a block of data all on one sheet. There are a ton of variations that you can do to make this work for other configurations. The idea is simple: create a new column of data for the chart and use normal formulas to get the data there. You can make the x-axis a selector as well.
For the simple case of a common x-axis with varying series for the y-axis all in one block of data, I do these steps:
Start = block of data
Add a column header off to the side which will "drive" the selection. I like to make this a Data Validation drop down so that the selection is correct. I did this in G2, selecting the column headers as the Source.
With this in place, you can use the selection there to update the data in the column below it. A simple formula for doing this uses INDEX.
Formula in G3, copied down to end of data: =INDEX($C$3:$E$25,,MATCH($G$2,$C$2:$E$2,0))
This formula works by finding the column name in the list of column headers and returning that column of data. Since the row selection is blank ,,, it relies on the relative position of the cell which works since everything is lined up.
Once this is done, you can then create the chart simply using the date and the new column of data. It will respond to changes in the selector which works nicely. If you use the column G header as the series name, that will update too which is a good effect for free. Below is the chart showing the ranges it is using.

Excel 2010 area chart drop off at the beginning

Earlier this week, I asked a question about getting an area chart to drop off vertically instead of diagonally when I don't have enough data for some series.
https://superuser.com/questions/809955/excel-2010-area-chart-drop-off
teyley's answer works really well, that's exactly what I wanted. However, there is now some situations where I will have data for February to August for example but no data for January (because the employee wasn't yet in the enterprise at this moment for example).
It does create a diagonal drop off at the beginning of the chart again even though January's data are set to NA(). Using teyley's answer, I can get dynamic ranges for the series, but it still has to be progressive, the first row of data will always be January using that method. What to do if the data for a specific series actually starts on February?
So, assuming I have data for February to August, using teyley's example and answer, how could I make it so that there is a vertical drop off in February instead of a diagonal going down to 0 on January?
Here is the formula for the dynamic named range:
FirstSeries = OFFSET($B$1,1,0,COUNT($B:$B),1)
Then, I use this in the chart for each series as shown in my earlier question:
=SERIES($B$1,$A$2:$A:$A13,Book1!FirstSeries,1)
I got this answer from another forum, but I've been looking quite a while for the answer, so I'll post it here as well. The original thread can be found here:
http://www.excelforum.com/showthread.php?t=1024240
make your category axis into dates (not text or select automatically)
insert a row in your excel sheet for the date where you want the cliff (move values down) and repeat that date. In your case your Date column will read: Jan, Feb, Feb, Mar, Apr, May etc, and you don't have to add any values in the cells that are created next to Feb in the One, Two, Three, and AxisSpacer columns.
I haven't researched how you can apply this with dynamic named ranges.
As Sean Cheshire pointed out in the comments, one solution is to add white squares over the diagonal area at the beginning. There are probably multiple ways to do this. What I've done is creating a new series in the chart but instead of using areas, I'm using white bars with no shadows/borders and with no spacing. That said, there is another problem: the bars are centered on the X-axis. It means that the white bars will either cover half of a month or will be half a month short. To get around this problem, I added another series of white bars. That way, with 2 bar series, the bars aren't centered anymore, I just have to make sure to put the bars in the right place by putting the right numbers (0 or 1) in the white series.
It is not really elegant but it's still a solution.
I was able to get a chart without a dropoff on the right (showing blank spaces), by using a "Placeholder" row that has a value of 0 across all columns.
Select the area you want on your table (notice, do NOT include empty/null cells)
Create the Area Chart, using that selection, and click Select Data to modify some values. Click Edit to update the Horizontal (Category) Axis Labels, highlight your column headers again and click OK so you see them listed in the right panel, then uncheck the "blank series" in the left panel. You need to keep Placeholder checked to show your empty columns to the right of your data.
Finally, select and delete the Placeholder label in the legend, so it's as if it isn't there.

Excel charts: prevent auto grouping of dates

I got an excel table with two columns: date (dd/mm/yyy hh:mm) and value (integers).
The table has about 8000 values in a time range of 4 days.
When I try to create a line or bar chart on these two columns, excel somehow accumulates all values for one day (ignoring the time). i.e. I get a bar chart with 4 bars.
What I actually want is having a bar/line chart where every single row resembles a bar/point in line chart. Where can I find the friggin option to tell Excel what I want?
INFO: I use MS Excel for Mac: 2011, but I am pretty sure this is not a version related issue, but rather a 8th layer problem ;)
When you create an axis that has time and date values, Excel tries to be helpful and guess what you are trying to do. I'm not sure about the mac, but in Excel 2010, when you right click the axis, and format it, this is the first window that pops up:
For the Axis Type (seen around the middle here) it has Automatically select based on data selected. This is what is grouping your data together as dates. Change it to a Text axis, and all the points on your graph should now appear.
You need to separate date from time.
Create a new column and copy your date/time field (via equation or copy/paste)
Format one column as a date and the other as time.
Now your chart shouldn't auto-group.
(I realize this question is old but maybe this will help someone else.)

Resources