Excel charts: prevent auto grouping of dates - excel

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

Related

Generate summary gantt chart from detailed activities

I want to create a gantt chart summary that shows a person´s whole "busy" and "free" schedule by day and in a single row, from a detailed gantt chart with a list of activities of different people in multiple rows.
Basically go from this:
To this: (which I created Manually)
To be able to give a summary of people´s shifts free time between activities.
Right now I´m just using this formula to compare the start and end date in each row and produce a "1" if the condition is True, then I just condition formatted the whole Gantt cells.
=IF(AND(Q$8>=$N12,DAY($K12)<>DAY($J12)),1,IF(AND(Q$8>=$N12-0.00001,Q$8<$O12-0.00001),1,""))
I have no idea how to start. I was thinking of doing the nest things:
Create a table of the names of all the possible people to be added in the gantt chart.
Program the macro to create a new sheet with the same template.
Program a loop which starts iterating with each person´s name:
For each person´s name which exists in the gantt chart to be summarized, start creating new rows per each day they have activities scheduled (I can´t figure out yet how I´d iterate through this).
Within the each person´s loop, start iterating each row on the original sheet, evaluating each start and end date´s and pasting on the new sheet´s current person´s current day row a "1" if the condition was true in the corresponding hours.
Loop until all individual activities of each person are finished.
Continue with next person.
I´d like to know if this is the logical way to go and if you have any pointers or similar code to recycle, I am not proficient in VBA and Excel macros.
Not sure if I understand properly, but it looks like you got a set of multiple records where you store the times In and Out of each worker, several rows for each worker.
And based on that, you would like to resume data, one row per worker, highlighting start and end time of each worker, but all in a single row.
I made a fake dataset like this:
I added 2 extra columns (you can even hide them if you don't want to see them)
Field START TIME got this formula:=B2-INT(B2)
Field END TIME got this formula: =C2-INT(C2)
In Excel, Dates are integers values and times are decimal values. I used both formulas to get only the decimal part of each start and end.
All this data is a table object named T_WORKERTIMES. I made a table object so if you add new records, the Gant Chart will autoupdate.
Then I made a simple (kind of horrible) Gant Chart:
The formula I've used in H2 and drag is:
=COUNTIFS(T_WORKERTIMES[Worker];$G2;T_WORKERTIMES[start time];"<="&H$1;T_WORKERTIMES[end time];">="&H$1)
Actually, all my data is in same sheet:
I added 2 Conditional Formating Rules to highlight cells in green/white if the result of the formula is 1/0.
Also, working with times sometimes can be hard, because decimals. 0,677083333335759 means 16:15. But 0,6770833333333333 too, so in Gant Chart I rounded up headers to 6 decimals.
My formula in H1 is =ROUND(7/24;6)
My formula in J1 and drag to right is =ROUND(H1+1/24/4;6)
So now everything works fine. Please, notice in worker 1, there is no activites from 07:00 to 08:00. So I add a new row with that data and everything updates:
I've uploaded a sample yo Google Drive you can see the formulas and hope you can adapt this to your needs.
https://drive.google.com/file/d/1KOuCAYsmlY9gfNUCUhIrihXu-tJz-K7t/view?usp=sharing
Biggest issue here is the decimal part of times, to make sure they fit the Gant Chart. An easy solution would be substracting just 1 minute to start time column (calculated, you can hide it) and sum 1 minute to end time column (calculated, you can hide it).
Hope this can guide you in your project.
It looks like you are trying to extract unique records per person and day to get a person/day summary of time availability but also want it to be automated as you add more people and days.
I was able to do this with a combination of powerquery and a pivot table. When new persons/dates are added or changed the report will update but you will need to refresh using CTRL+ALT+F5
you want to highlight your entire report or an area as big as you think it will get. While highlighted you will then utilize named range feature under FORMULAS tab -> DEFINED NAMES ribbon -> DEFINED NAME dropdown. We could name it REPORTAREA or something like that.
Make sure you change the conditional format formula in report to show 0 instead of "" so this can work properly
2 go to DATA tab -> GET AND TRANSFORM ribbon -> From other sources -> Blank Query.
This will open the power query editor as a blank query
3 In the formula bar type =Excel.CurrentWorkbook() case sensitive is important
4 From there you will see CONTENT and NAME column.
In the NAME Column select the drop down and go to TEXT FILTERS -> Equals... Type in the name of your named range so the query does not pick up anything else on accident.
5 Remove the NAME column by right click selecting it and then remove.
6 you will notice the CONTENT column has two curved arrows pointing left and right instead of straight down like you are used to in excel. Click these arrows and make sure you uncheck the "use original column name as prefix" option box and ensure that the EXPAND option is selected. Then click okay.
7 At this point it looks alot like your report. Go to the HOME tab -> TRANSFORM ribbon -> Use first row as headers.
8.Select only the columns that are NOT THE 24 hr STYLE TIME LABELS of your report and then right click -> Unpivot other columns
9 At this point you can start removing some of the columns you dont want by right click and remove. Also double click and rename the columns as you wish. You can right click the top of the column and change types to what you want.
Dont worry about the 24HR style time zones not looking correct as this will be fixed later, this column should be changed to decimal type and not time zone type.
select a column that has the date information you need and right click -> Duplicate column -> change type to date.
11.At the top left part of the screen there is a CLOSE AND LOAD drop down where you will load to a new worksheet.
That will produce a green table. Select the table and press ALT+D+P to produce a pivot table linked to the green table you produced from the query.
You may need to close the Queries and Connections box that opened in order to see the pivot table options that will appear on you right.
Drag the 24hr style column to the columns area.
Drag the People to the Rows area and after Drag the Column you made in step 10 to the Rows area.
Drag the conditional format column to the Values area.
Your pivot table wont look exactly like what you want. while pivot table is selected go to DESIGN tab -> REPORT LAYOUT -> Tabular and also SUBTOTALS -> DO NOT SHOW SUBTOTALS while in the same tab.
13 Highlight all of the 24hr style time labels and format them and after highlight the inside of the pivot table where all the 1 and 0 will be and apply the conditional formatting you applied previously. Dont forget you changed the formula originally so your if statement does not end with "" but instead with 0.
If you would like i think it is easier to switch around the ROWS and COLUMNS area of the pivot table fields so that the report is easier to read. I have chosen to do so in the pictures. If you want to keep the report the way you are used to you can follow previous instructions.
I put the above comment down here as a complete answer.
I call those cells after "Finish date" column as "Chart cells". To extract a unique list of names, please refers to: here
If each name, you can use the followings formula and format for cells value >0 to show the bars.
=SUMIF([name range], "[each name]", [for each column of the chart cells])
If you further needs to filter by dates, you need to use sumifs() instead:
=SUMIFS([each column of chart cells], [name range], [unique name obtained from above], [Finish date range],"<=" & DATEVALUE("[target date]")+1,[start date range],"<=" & DATEVALUE("[target date]"))
This is the Excel formula solution, which is good if your table is not huge.

Line Chart in excel with date times

I'm trying to create a line chart in excel where the x axis is date time.
ie, the format is
But when I highlight the columns and click the line chart icon I get
Excel seems to insist on using only one of the dates and always puts the data series in the title.
This seems very strange to me.
What am I doing wrong here?
You should mark the complete range A and B and then press the button for adding a line chart.
I figured it out, excel was formatting my second column of numbers as text. So the graph was not generating.
I didn't notice it at first, but the column indentation indicates that those numbers are actually text fields.

How to make an Excel line chart ignore certain cells?

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.

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.

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