I want to plot a graph in excel which has x-axis values as times(just of one day, this will be plotted everyday) and y-axis values as different applications. Suppose an application A runs jobs from 1:00 pm to 2:00 pm and then from 4:00 pm to 6:00 pm. Is there a way I can plot these time durations for each application?
I am visualizing a graph where an application has a colored bar next to it for the time period 1pm to 2pm and then it is blank until 4pm where another colored bar appears till 6pm.
Is this possible? I have the start and end times of jobs for each application. Differentiating between jobs is not important. I just need to know when the application is running and when it is idle.
Any help would be appreciated! Thanks
A little example:
The data is a label in ColumnA (for the y-axis) and 'readings' (here in B1:G1). The 'readings' are the length of the static intervals (in hours). 0 because the day has changed, then 13 because nothing happens until 1p.m., 1 because busy 1-2 p.m. - and so on.
If charted with Insert Stacked Bar the default will be to colour fill each range (interval) with a different colour. For the image, the colour for alternate 'series' has been set to match the background and one of the remaining set to match the other.
I admit changing the fill manually could get tedious if required daily for many apps but there is always VBA! And with a small fudge you may be able to 'recycle' (ie use the chart as a template and just overwrite "yesterday's" data.
Related
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.
I have come across this problem several times, so I would like to ask you now. I often need to create time series with hourly time steps (usually for the length of one year).
So I start to write
01.01.2001 00:00
01.01.2001 01:00
01.01.2001 02:00
Then I drag the the fill handle, so that Excel automatically fills the next lines until 31.12.2001. But, for what reason ever, there is a sudden jump of only 59 minutes instead of a full hour:
05.01.2001 03:00
05.01.2001 03:59
05.01.2001 04:59
Anybody else who came across this? And can me explain the reason and/or recommend alternatives for an automatic creation of the time series?
In the first cell you need to change number format to
dd.mm.rrrr g:mm;#
Then you can write your first date and time. When you drag the fill to the second cell - edit it to get next hour. Then when you select this two cell and drag fill handle you'll get automatically time series +hour
picture
After publishing a too broad question in the first place, I want to ask for a second time – more problem-focused.
The shown bar chart is needed for a broad variety of projects and will be used for 6 month projects as well as for 3 year projects.
But it will be forwarded – so it should look professional.
For this reason I want to change the dates on the x-axis to the first of every month. For a fixed period of time, I would be able to do so. But for a broad variety of durations, it’ll have to have some vba code in the background – and that’s where I’m dipping in the dark. All my testing with start and end date didn’t work out. There’s too much variety in these numbers.
I’ll show the vba of the chart down below. It’s just recorded and has no special tricks inside.
Is there a way, to get there? With calculation between start and end date, I didn’t get a reliable result for first of each month for a random time period.
Thanks for your help! <3
Sub testStackoverflow()
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlBarStacked
ActiveChart.SetSourceData Source:=Range("testStckoverflow!$A$86:$B$96")
ActiveChart.Legend.Select
Selection.Delete
ActiveSheet.ChartObjects("Diagramm 3").Activate
ActiveChart.ChartTitle.Select
Selection.Delete
End Sub
I think you can just use a 2D horizontal stacked bar chart.
Set the start of the chart's x-axis as the first day of the earliest month that appears in the project schedule.
Series 1 for each task is the difference between the task start date and the date which starts the chart's x-axis. This allows you to show tasks which don't all start at the same date. Set the bar portion for this series to transparent.
Series 2 for each task is the task duration in days. This portion of each bar should be set to be visible.
Format the X-axis of the chart to Category: Date, Type: Month-Year. This will set each tick to the first day of each month.
Formatted bar chart
So I want to make a load duration curve in excel. And I have the demand and the time for which the EV is active for a year. So basically I want to make a load curve for the whole year. My problem is that I only have like a starting and end time where the EV is active during the day and data does not show that it is zero elsewhere.
So I want to create a whole sheet with 24 hour times for 365 days using the data that I have.
My confusion is how to take the limited data that i have which starts at any time not on the hour to make a full 24 hr one year data for a load duration curve.
In a chart with 365 days on the X axis, the distinction between different times of the day will be difficult to discern.
If you use a line chart you can set it to show empty cells as zero instead of connecting empty cells with a line.
If you want the line to drop to zero, you must have rows for that date with no data in the values column.
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.