Excel 2010 area chart drop off at the beginning - excel

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.

Related

Gantt chart on Excel - Conditional Formatting based on the number of days for a task which are in a given month

I'm trying to build a Gantt Chart in Excel where I could conditionally fortmat cells to reflect the number of days a task has on a given month.
For example, today is 24-oct-19. A task starting on 11-oct-19 and ending on 08-nov-19 has 20 days on October and 8 days in November. I need to conditionally format a cell on the task row, October column, to be painted in a proportion given by 20/31. I should format similarly the same row, November column.
None of the many Gantt charts I found online could make it. Could you please give advice on how could I do this?
I'm also attaching a sketch.
Thank you!
Gantt chart with next 12 months
Just a proof of concept (not very aesthetically pleasing because of padding round cells, but this can be fixed).
I just wanted to see if you could get a reasonable chart using basic string functions to get a bar in the right position in each cell:
=IFERROR(LEFT($A$5,ROUND((MAX(D$1,$B6)-D$1)/DAY(EOMONTH(D$1,0))*10,0))&LEFT($A$3,ROUND((MIN($C6,EOMONTH(D$1,0))-MAX(D$1,$B6)+1)/DAY(EOMONTH(D$1,0))*10,0)),"")
Slightly more pleasing appearance - the trick is to centre the text in the cell, but then you need to include spaces to the right where necessary (e.g. in cell E6) to make it work:
=IFERROR(LEFT($A$5,ROUND((MAX(D$1,$B6)-D$1)/DAY(EOMONTH(D$1,0))*10,0))
&LEFT($A$3,ROUND((MIN($C6,EOMONTH(D$1,0))-MAX(D$1,$B6)+1)/DAY(EOMONTH(D$1,0))*10,0))
&LEFT($A$5,ROUND((EOMONTH(D$1,0)-MIN(EOMONTH(D$1,0),$C6))/DAY(EOMONTH(D$1,0))*10,0)),"")
To get fixed character size, I have set the area where the bars are to use Courier font, and chosen a suitable column width.

Excel: Add number to upper right corner of box of merged cells

I have an excel form which displays a six generation family pedigree chart. Each box for a person's data is merged together from 3 columns and 7 rows. 4 lines of text fit into each box, the 1st line is name, the 2nd birth date and place, the 3rd marriage date and place and the 4th death date and place.
The rightmost two columns are the triple great grandparents of the root person and sometimes a 2nd chart is needed to show their ancestors. The 2nd chart tile is Chart mm-nn where mm is the chart number where the person appears as a GGG grandparent and nn is their number in that chart.
How can I put a number in the upper right corner of these boxes in my chart?
I thought of appending the number to the person's name and flush it right. If possible, it must be with some exotic format string. But each box has 4 text lines and the flush right formatting needs only apply to the 1st.
Perhaps make the numbers as little graphics and overlay them? Chop up the base cells even smaller and merge them into 4 separate lines with the 1st line shorter than the others with a small number box at the end of it?
Ideas?
Jim
The short answer to your question is: no, that's not possible. This is Excel not MS Word. Hence, you can set any given cell only to be left-justified or right-justified. You cannot have both for one cell.
Yet, maybe any of the following work-around might be of help in your case. Of course, I can't be sure since you haven't provided any screenshots of the desired out-come (like a mock-up). But here we go:
This is where you are coming from. A merged box of three columns by seven rows containing four lines of text.
(1) One solution might be to have three different merged areas. The following example consists of three merged areas. The first two rows and the first two columns make up the name. The last column on the first two rows is merged to contain the number and the rest is one merged box again containing the dates and the places.
Note, that you can only see the difference to the original since I selected in this example the top right merged area (consisting of the number only). Otherwise, there wouldn't be any (visually apparent) difference.
(2) Another solution could be to manually insert as many spaces after the name as necessary to make it seem as if it were right-justified. The problem here is (of course) that this changes with the font, the font-size, if the font is bold (or italic) or not, and also the current zoom-factor for the sheet. Hence, this solution would soon wear you out as you would have to manually adjust all the cells constantly. I just wanted to point out this solution for the sake of completeness.
(3) The following solution consists of a text box shape on top of the cell. So, basically I am leaving your original cell (consisting of three columns and seven rows) as is and simply put a shape on top of that cell. The following screenshot shows the result in the top part and the text box being selected in the bottom part (so you can see how this one comes together).
(4) The following work-around is probably the solution you've been looking for and you want to go with. This one is moving away from the cells on the sheet and relies only on text-boxes which are shown on top of the sheet (and thus on top of the cells). Here you can "merge" several text boxes into a group. The group will move and size as a whole. At the same time this group consists of several text boxes and as such may consist of left-justified text boxes and right-justified text boxes as you can see in the screencast below.

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.)

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

How do I avoid merging cells vertically in excel?

I'm tired of merged cells. They just don't work.
So I found a way to avoid merging cells horizontally, when I just need my text to be centered across multiple columns. That's: Range("A1:C1").HorizontalAlignment = xlCenterAcrossSelection.
It works like a charm. It's perfect. It's just what I needed.
I oh-so-naively thought you could do the same vertically, for centering text over multiple rows. Something like: Range("A1:A3").VerticalAlignment = xlCenterAcrossSelection.
But alas, that doesn't work.
Am I missing something here, or did Excel developers really think that, while centering across columns is a common deal, centering over rows is so much of a silly idea nobody would ever do that so why even bother?
You can try this:
Sub VerticalAlign()
ThisWorkbook.Sheets(1).Cells(Round((WorksheetFunction.CountA(Range("A1:A6")) + WorksheetFunction.CountBlank(Range("A1:A6"))) / 2, 0), "A") = "Your Value Here"
End Sub
You'll need to change the ranges being counted, and the column it's referring to, but that should just about do it. A little warning, though: VBA does NOT round the same way that Excel does. It should always be within one digit, though. You can read more about that here: http://support.microsoft.com/kb/194983
We use textbox shapes over cells to do this. If you hold Alt while drawing out the shape, the corners will snap to the Excel grid and move and size with the cells, so it doesn't take much more time than typing into the cells.
I found a happy accident that works around my issue on this if anyone cares to know.
For my situation I needed to track employee vacation time on a linear calendar that was sort-able by name and responsible area. The title section covered three rows that i wanted visible when the data below was filtered. Row 1 = years (merged across months), Row 2 = months (merged across days), Row 3 = days.
Cells A1:A3 was merged and labeled Names (employees), B1:B3 merged and labeled AREA (responsibilities) so we could track vacation time on a calendar spreadsheet to make sure each area had coverage (at least one employee responsible for it was available). The downside of this method caused the filter blocks to be associated with row 1, so row 2 and 3 were hidden when names were filtered on.
Then I tried the VBA code from previous post and it worked, but maxed out at font size that would fit, if too big it would be cut off. So Aesthetically, it looked bad.
Then I put the Names/Area titles in cells A3 and B3 without merge and set filters on row three. This filtered everything starting at row 4 effectively without hiding anything above it, but still looked bad.
Now I found the work around. If you have your titles in the top cell of where you want to merge, and some value in the bottom section. Set filters on the bottom section (need a value to set filters). Then merge the three cells, it works.
So now my A1:A3 Name, and B1:B3 Area is merged, but the filter boxes are on the bottom of the sections (aligned with row 3).
Hopefully that works for some people. I then locked those cells from edit (except auto filter settings) and now it cant be changed accidentally. only filtered.

Resources