Determining the optimal excel chart major unit - excel

one of my tasks is updating a presentation with zillion charts.
Since there are 4 charts per slide it is important that the major unit on a chart is set so that the charts are legible.
I found a way to code some steps and cut the time significantly but one of the missing pieces is determining the major unit of a chart.
So the question is:
Is there a way to to determine through formulas or vba what should be the major unit in a date type x axis based on the dynamic start date and end date (I want last date to be shown on a graph)
Bellow is the example:
dates are having one week interval
I need the final date that shows up in pivot to be on the chart
I need the chart dates to be legible given that it will take quarter of a slide
chart example
I tried going through similar questions and one of the solutions (that didnt work for me) was:
using Days360 to calculate number of days between start and end date
adding 1 to be inclusive of start and end day
dividing that number of days with number of wanted ticks minus one
so far I was using 27 as a number of ticks, based on legibility experience
If I find a way to precisely determine a number to be used I will use it as a reference # for my macro that changes all the applicable charts
Could anyone help me out please?

Related

Excel - Plot time slots on a continuous time axis

Let's say we have time slots documented in which a production line was running. In between each product maufactured are time slots in which the machine was idling.
I now want to plot the machine status over time, basically as a boolean value (running vs idling).
I get the machine log and need the chart on the right.
The machining duration will ultimately be logged including seconds and may vary for each product.
The first - and probably biggest - challenge for me is to find a smart way to extract the status from the time stamps. My current first step ist to create a table row for each minute and use the if statement in H4 to check wether article 1 was being manufactured.
IF(AND([#Time]>Machine_log[#Start],[#Time]<Machine_log[#Finish]);;)
However, since the final list will range over 24 hours or more and the number of articles quickly reaches 50 and more, I would love to avoid using nested IFs on this one..
I'm thankfull for any input and open for inspiration :)
Thank you all in advance!
PS: Anyone know how a better way than a scatter chart with two values per X-Value to display the chart as vertical lines/right angles like this?
One option is to add only those points that are necessary to the Status extraction table (which I named "Status"). (I named the Machine log table "Log").
Note: it looks like you are using a semicolon list separator, so you'll need to change the commas in the formulas below to semicolons.
Formula for the Time column:
=IF(ROW()=ROW(Status),MIN(Log[Start])-1/144,IFERROR(INDEX(Log[[Start]:[Finish]],INT((ROW()-ROW(Status)-1)/4)+1,MOD(INT((ROW()-ROW(Status)-1)/2),2)+1),MAX(Log[Finish])+1/144))
Formula for the Production running? column (enter into H4 and fill down):
=IF(SUMPRODUCT(--(Log[[Start]:[Finish]]=[#Time])),IF([#Time]=G3,3-H3,H3),1)
These formulas will pad your plot with 10 minutes of off time on either side.
To answer your question about avoiding two points for each x-value: no, each point on the plot has to have a corresponding data pair.
UPDATE IN RESPONSE TO COMMENT: I failed to mention that the above solution assumes the time data in the Machine log table are in ascending order. This means that if your data span more than one day, they will need to contain a date component or you can get plots where the line crosses back to the beginning. For example, if you have 23:57:00 followed by 00:10:00 with no date component, Excel treats these as 11:57 pm on 1 January 1900 and 12:10 am on 1 January 1900. (To see this, change the format to "General", and you'll see the values that Excel uses to encode date-time aren't in ascending order.) The solution is to enter the dates as "8/16/2020 23:57:00" and "8/17/2020 00:10:00" in the formula bar. If you're copying over from another data source, the date needs to be copied with the time. If the dates and times are in separate columns, your Start and Finish columns would each be a date column plus a time column.

Creating a Stack Area Chart that shows Issues over Time using Beginning and End Dates

My Data looks like this:
||UNIQUE_KEY||LABEL1||LABEL2||START_DATE||END_DATE||
What I'd like to do is have 2 stacked area charts that show totals (count of UNIQUE_KEY), one chart for LABEL1 values & another for LABEL2values over time.
X axis would be Number, Y would be time. Charts would show a count of UNIQUE_KEY for each of the possible LABEL# values at each point in time.
I am at a loss how to translate the Start Date and End Dates into a framework so that excel considers that Issue open at that point in time for the dates that fall in between Start and End date.
I can think of ways to do it that are really ugly and I have to know id there's a slick way to get what I want.
Thanks!
edit... here's a snippet of the data (comma delimited) - and I refined my explanation above
Issue key,Issue Type,Work Type,Created,Resolved
SA-17070,Maintenance,PS_SYSTEM,7/7/2014,8/29/2014
SA-17006,Production Incident,PACKAGING,6/30/2014,8/29/2014
SA-23110,Production Incident,BUSINESS_PROCESS,8/1/2016,9/12/2016
SA-22628,Enhancement,BUSINESS_PROCESS,5/23/2016,8/25/2016
SA-16073,Maintenance,BUNDLE,4/17/2014,5/16/2014
SA-15625,Maintenance,BUNDLE,3/6/2014,3/14/2014
SA-17008,Maintenance,BUNDLE,6/30/2014,7/3/2014
SA-17062,Maintenance,BUNDLE,7/3/2014,7/7/2014
SA-16922,Maintenance,BUNDLE,6/19/2014,7/7/2014
SA-16913,Maintenance,BUNDLE,6/18/2014,7/7/2014
SA-17064,Maintenance,BUNDLE,7/7/2014,7/8/2014
SA-16956,Maintenance,BUNDLE,6/24/2014,7/28/2014
SA-17172,Maintenance,BUNDLE,7/15/2014,8/29/2014
SA-17349,Production Incident,BUNDLE,8/4/2014,8/7/2014
SA-19038,Configuration,BUNDLE,2/16/2015,2/19/2015
SA-19011,Maintenance,BUNDLE,2/12/2015,2/16/2015
SA-19298,Maintenance,BUNDLE,3/12/2015,3/23/2015
SA-19065,Production Incident,BUNDLE,2/18/2015,3/23/2015
SA-19235,Production Incident,BUNDLE,3/9/2015,4/30/2015
SA-20192,Maintenance,BUNDLE,7/13/2015,7/15/2015
SA-21317,Maintenance,BUNDLE,11/19/2015,12/2/2015
SA-21169,Maintenance,BUNDLE,11/3/2015,2/1/2016
SA-21283,Production Incident,BUNDLE,11/17/2015,12/11/2015
SA-21329,Production Incident,BUNDLE,11/19/2015,1/4/2016
SA-23487,Maintenance,BUNDLE,9/12/2016,10/25/2016
SA-23356,Maintenance,BUNDLE,8/29/2016,10/25/2016
SA-23443,Production Incident,BUNDLE,9/7/2016,9/9/2016
SA-23589,Production Incident,BUNDLE,9/24/2016,9/24/2016
SA-23931,Enhancement,BUNDLE,11/21/2016,12/2/2016
SA-17356,Configuration,PS_SYSTEM,8/4/2014,10/7/2014
This is not exactly what you described. This shows dates an issue is open on the Y-Axis, versus the issue number on the X-Axis. I know you want something different on the X-Axis, but it is unclear how you want this to map to the Y-Axis. (e.g. maximum Resolved time - minimum Created time?, duration of latest issue?)
Note: You could do the following once for each Issue Type, once for each Work Type.
To create a chart showing duration an issue is open, where duration is on the Y-axis and the issue "key" is on the X-axis ...
Add a column to your data that is Duration. It is Resolved - Created.
Select the Issue Key Column, Created Column, and the Duration column.
Insert a Stacked Column Chart.
Select the Resolved series and format. Set the fill color and line color to None.
Select the Y-axis and format the axis. Adjust the lower limit to something you want. Change the number format to Date.

Creating bar graph of event occurrences for each month of several years in excel

I have a long list of dates (about 2000) in an excel spreadsheet and I want to see how many of these dates lie within particular years (and roughly which part of the year also if possible). I know how to make basic graphs in excel, but I'm not sure how to make a bar graph that uses dates. Any suggestions?
I can obviously split events in day, month, and year and then use count to count the amount of each year, but this would not show the placement of the event within the year in the final graph.
20/03/2000
2/04/2000
3/04/2000
26/05/2000
7/06/2000
20/06/2000
22/06/2000
10/07/2000
12/07/2000
22/07/2000
2/08/2000
8/08/2000
11/08/2000
14/08/2000
15/08/2000
12/09/2000
15/09/2000
20/09/2000
25/09/2000
2/10/2000
22/10/2000
24/10/2000
25/10/2000
27/10/2000
1/11/2000
10/11/2000
13/11/2000
16/11/2000
18/11/2000
20/11/2000
25/11/2000
27/11/2000
3/12/2000
6/12/2000
20/12/2000
21/12/2000
22/12/2000
4/01/2001
7/01/2001
11/01/2001
24/01/2001
25/01/2001
2/02/2001
4/02/2001
9/02/2001
12/02/2001
13/02/2001
20/02/2001
21/02/2001
2/03/2001
11/04/2001
19/04/2001
20/04/2001
21/04/2001
24/04/2001
27/04/2001
28/04/2001
2/05/2001
3/05/2001
5/05/2001
12/05/2001
13/06/2001
20/06/2001
25/06/2001
3/07/2001
5/07/2001
18/07/2001
20/07/2001
21/07/2001
22/07/2001
25/07/2001
4/08/2001
5/08/2001
9/08/2001
10/08/2001
11/08/2001
12/08/2001
13/08/2001
31/08/2001
11/09/2001
12/09/2001
17/09/2001
3/10/2001
10/10/2001
18/10/2001
21/10/2001
23/10/2001
4/11/2001
5/11/2001
17/11/2001
22/11/2001
23/11/2001
27/11/2001
29/11/2001
3/12/2001
I cannot check this in earlier versions of Excel, but in Excel 2016, if you build a Pivot Table with your data and drop the date in the Rows - you get your data grouped in Years, Quarters, and Months. If you also drop the date into Values, then you get the Count of values in each year, quarter, and month.
Then a pivot chart looks like this ...
A less magical way to do it
Applies to Excel 2013 and up
From your single column of dates, build a pivot table.
Put the date in Rows. Put Count of date in Values.
Select any one of the dates. Right Click and choose "Group...", or choose "Group Selection" from the Analyze ribbon.
Click on each of Months, Quarters, and Years.
Filter how you would like.
Select PivotChart from the Analyze Ribbon.
You can create a scatter graph as suggested in the comment. Consider your data set and see if there is any other quality that could be added to the chart, which could be plotted on the value axis. For example the number of people attending the event, or the duration of the event in seconds, or something like that, so that the graph contains more information. In the following screenshot, the blue dots are just the 1's from column B plotted on the time line. The orange dots plot another data aspect on the vertical axis.
If you create a pivot table of the dates and drag the date into the Sums area you will get a count of each day, make sure this is sorted. Then a chart will show the number of records for each day. You will need to copy and past values from the pivot to a new sheet to be able to make a scatter diagram from the output of the pivot table (in Excel 2010). But once it is a scatter diagram the events will be in the "correct" places.
If you wanted to group it by month instead you could use a formula to create a column of year & month and then do the pivot and chart on that column. For example the formula below will give you 201605 for May 2016.
=YEAR(A2)&RIGHT(100+MONTH(A2),2)
Weeks would be a bit trickier, but I suppose you could divide the date by seven and then INT it to get a 7 day grouping. These wont show the actual events occurance within the period but would let you see which periods have the most events.If you are looking for things like more events at the beginning of the month or something you might need to try different "groupings" like weekly.

Chart or in Excel From List of Timestamps

I have a program that writes the currenct time to excel when a process is called, so I have an excel file with one column of over 5000 timestamps in HH(24):MM:SS format. I'm trying to visualize these over a 24 hour period in order to find a time where the process is least likely to occur. Can anyone get me started?
Thanks
Simply selecting the data in your column and Insert > Charts – Scatter, Scatter with only Markers might suit. The closer the markers to one another (or the shallower the slope) should indicate the process has been called often in a short time interval. ie the quieter periods are when the slope is steep.
If not a very helpful visualisation then maybe count the number of starts over intervals of fixed length (create ‘bins’) and plot a histogram. “a time where the process is least likely to occur” implies that not only start time but duration may be relevant. In which case an an interval of approximately the average duration may be useful.
If you give Excel a column of timestamps in a format it understands, it can map them to a fraction representing how far into the day that timestamp is. For example, if you paste in "12:00:00" and then format that cell as a number, you will get 0.5. Likewise 06:00:00 to 0.25, etc. These numbers can then be plotted on a histogram by following these steps.
Caveat: Only confirmed this works in Excel 2013.

How to get an Excel graph show "up to" current day of week

In Mac Excel 2011 I have a Scrum burndown chart that tracks the number of points ‘burnt’ per day (starting from say 100, hopefully burning down to 0).
The number of points per day is made up of a sum of X number of columns (tasks).
I then have a marked line graph which takes it’s Y value data from the summed points per day.
My issue is that the marked line graph will always display 5 work days worth of burn, even though we might be on Tuesday.
I need a solution that means I don’t have to manually update the graph y value each day (adding it), instead the graph knows it is Wednesday, and selects data up to Wednesday.
Do you want to show the days for the whole week? (probably, since a 1 or 2 day chart early in the week will look funny.) Are the Y values linked from another cell?
If so, change your links from
=A1
to
=IF(LEN(A1)=0,NA(),A1)
NA() produces #N/A in the cell, which isn't plotted.

Resources