How to make an Excel line chart ignore certain cells? - excel

I have monthly values in a column with cumulative values in the adjacent column. The cumulative calculation should only work where there is data for that month so I have used formulas such as =IF(E6>0,F5+E6,"")
I need a line chart showing the cumulative results but I don't want Excel to plot the cells containing "" Is this possible, using either chart options, or by changing the cumulative formula?
I've tried to post a picture of my chart but I'm new here so it won't allow me to. Let's see if it allows a link to mediafire instead.
In my picture (if you can see it) I want the red line for 2015 to stop at March, instead of plotting zeroes for the rest of the year.
Link to screenshot

One possible solution is to use:
=IF(E6>0,F5+E6,NA())
It will display #N/A instead of empty string. If it doesn't look OK, you could create a helper column with this formula, add it to chart, and hide this column.

Related

How can I get my Excel spill range to be grouped by a specific column for a chart?

I need to produce a chart in Excel to show a quantity of items for a number of categories, grouped by the month they were received. At the moment, every occurrence of the Month shows up in my clustered column chart. I can manually do a table and remove all except the first occurrence of each month, but I need it to be done dynamically as the date range can be changed (between 1 and 12 months). I have a full list of data for 12 months, showing Types and their Quantity received. I've filtered the list to just show the types and quantities received between the date range selected (picture 1).
The three images below show the spilled data, the current chart, and how I would like the chart to look. If it cannot be achieved directly using a spill range, then could anyone suggest another approach to have my data dynamically displayed in a chart, grouped by month?
Not a perfect answer but here's a start:
You could paste:
=IF(COUNTIF(F$5:F5,F5)=1, F5,"")
in J5, and drag this down a sufficient way to cover the expected length of the dynamic array.
Then paste:
=CHOOSECOLS(F5#,2,3)
in K5, and use these three columns for your graph data.
I can't think of a way to make the "J" column dynamic at the moment.
EDIT:
Pasting:
=XLOOKUP(ROW(F5#), XMATCH(UNIQUE(CHOOSECOLS(F5#,1)),CHOOSECOLS(F5#,1))+4, UNIQUE(CHOOSECOLS(F5#,1)),"")
in J5 should work dynamically too.

Using GETPIVOTDATA to return "total" column from changing Dates from Timeline selection

I have a pivot table, that ultimately, I want to have a line chart for just the total column; not two separate lines from the individual resultant cells
I wasn't able to find that as a possibility, so I turned to GETPIVOTDATA in separate cells that I could use to pull to the line chart. However the pivot chart is also connected to a TimeLine, which means the date column is dynamic. If I try to use the formula for GETPIVOTDATA the self Generate puts a specific month, year in it; ex. =GETPIVOTDATA("Weight",$A$3,"Months",6,"Years",2021) I have not been able to get a dynamic reference or spill function to work for this.

Is there a way to assign a cell value as the cell number in the Excel formula?

I need to arrange the hourly data to calculate the diurnal variation boxplot in Excel and prepare a template to calculate it for other data too. I have found an OFFSET and also INDEX excel function to do it in the link (https://answers.microsoft.com/en-us/msoffice/forum/msoffice_excel-mso_winother-mso_2010/drag-horizontally-increase-reference-vertically/f35cdc98-e6b4-43d4-9128-5fdffcdb93ed).
I can get all the vertical values in the horizontal form (like the transpose) but I would have to cut and paste all the data for 365 days to arrange it in the form presented in the picture.
For other dates, I want to change the cell number in the reference value($B$4) in the OFFSET formula to another value shown in Column D (4,28,52....) and drag it down until I arrange the values for 365 days.
*Is there a way that I could incorporate the cell value in column D (4,28,52....) in the OFFSET formula (=OFFSET($B$4,(COLUMN(A1)-1)1,0)), replacing $B$4 with $B$28, $B$52 and so on?
If there is a simpler way to arrange these values, that would be much appreciated too. Thank you in advance!
I would just split the dateTime column by delimiter or fixed width (Text to Columns function on Data tab in Ribbon) so you have one column for date and one for time and then simply put it in the pivot table.

Excel - dynamic chart x axis - ignore x categories with no data

I have a predefined list of x labels, e.g. months of the year.
I want to dynamically exclude some of these from my excel plot, e.g. if some of the y values are blank, zero or errors.
Things I've tried:
If I use an (if data is bad, then change xlabel to blank or NA())
process, excel still leaves a space for the blank or #N/A x label - see image. This is the second most upvoted answer to Creating a chart in Excel that ignores #N/A or blank cells, but doesn't quite do what I'm after... Unfortunately, there is no option for 'No Gaps' in the Hidden and Empty Cell Settings.
If I filter out rows where the Y values meet the reject condition, I get the chart I want, but the filter doesn't update automatically when the Y values get changed by a calculation elsewhere, ie its not dynamic. Pivot charts are the same.
I can't get formulaic named ranges (Excel charts - setting series end dynamically) to do what I want - the formula will return something like 'Jan, FALSE, Mar, Apr' rather than 'Jan, Mar, Apr', and we end up with the same problem as in the picture above.
Non-VBA solutions preferred = )
Buddy, seems Non-VBA solution is still to be found, as solution lies on hiding the said row.
However if you are bent on finding non-vba solution then here is very crude solution -
suppose this is the data (C3:I15) with the helper columns which has been described below -
helper column (hC1) has formula
=IF(ISNUMBER(D4),1,"")
hC2 has formula
=IFERROR(E4*ROW(),"")
hC3 has formula
=SMALL($F$4:$F$15,ROW()-3)
X has formula
=IF(ISNUMBER(G4),INDEX(C4:C15,MATCH(G4,F4:F15,0)),"")
Y has formula
=VLOOKUP(H4,C4:D15,2,FALSE)
drag down all the formulas after entering into first rows....
Now you can plot chart from continuous data -

Ignore cells on Excel line graph

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

Resources