Chart or in Excel From List of Timestamps - excel

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.

Related

Subtracting times across a day in excel

I am working on the capstone project in of the Google Career Certificate in Data Analytics. I am using Microsoft Excel. I have to calculate the ride length based on the start and end ride times. I've inputted the formula =F2(end time)-D2(start time) which returns the ride length. Going through my entire list I have some areas where the start time is like 11pm and the end time is 1am and this is returning ###### because it is a negative number with the regular formula. I've found a modified formula that can kind of do the conversion I am looking for but it is still a bit problematic. The modified formula is =(F2-D2+(F2<D2))*24 and it seems to give an accurate ride length if I reformat the answer to number. The issue is the rest of my data is in time format and the modified ones are in number format. If I convert the number values to time, the ride length values are inaccurate.
It is tricky to make the numeric value change as well due to me using a formula. I can correct them one by one after I save Excel and it no longer stores the numbers as the formula, but there are lots of data points to change and that would be time consuming. I'm hoping to find a more concise way to solve this problem. Maybe with a better formula.
[Snippet of the chart 1
Just like everything in life, there are multiple ways to achieve things. I would have formatted the date and time into a single cell; but. if you're gathering the data from another source, that's understandable.
A simple IF statement here will work. IF the days are one apart, then take '1' day off the starting time, else do your original formula:
=IF(E4-C4=1,F4-(D4-1),F4-D4)

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.

Forcing order with time format on Excel

I run a test overnight and have the results written on a txt file that I later extract the time and value from. The result is something like this:
Time data
Because it goes overnight and the time resets, the resulting plot is this:
Out of order plot
Is there any way to force the order in which the values are plotted without modifying the original .txt file so that it looks like my daytime tests?
in order plot
Edit:
Indeed the actual data skips and the timestamps are not periodic, here's how it looks around midnight
Not periodic timestamps
You will need a helper column and you need to make sure your time is actual excel time, and not a time string. Assuming your time is in column B starting in cell B2 you can use the following process:
1) Test cell
=ISNUMBER(B2)
If that is TRUE then you know you have your time stored in excel format. In excel time is stores as a decimal which represents the portion of a day. 12 noon is 0.5. Dates are stored as integers and represent number of days since 1900/01/01 with that date being day 1.
2) Add 24 hour increment
In order to properly sort your order for graphing purposes, you will need to add a day everytime your data passes the 24 / midnight mark. Assuming your data is sorted chronologically as per your example, use the following formulas in lets say column C
First cell C2
=B2
In C3 and copy down
=IF(B2>B3, B3+1,B3)
which can be rewritten as
=B3+(B2>B3)
Now format the cells in C for time. The date will not display, only time will. The times after the 23:59:59 mark will all be the following day.

Reducing duration by a percentage in excel

I have been racking my brain for hours on how to do this, so I am reaching out to some of you excel experts.
Say you have a duration represented as 1d 14:25:00 and you want to reduce that by a given percent, such as 149.5%, how can this be done?
At first I thought about going down the route of having a cell formatted in time, but when you try and do math against it, it fails.
Then I thought about maybe converting the time down to seconds and working with that, but that seems like it is total pain in the rear. It involves a lot of converting from time to number then back to time to display it. There has to be an easier way.
It depends on how you format the cell to read the Date/Time. If it's represented as a Time, then I believe the best approach is to convert the percentage into a decimal number (i.e 150% = 1.5), then use that in your formula.
However, it also requires applying the cell format to the custom format of [h]:mm:ss to include any times above 24 hours. See the image below for an example.
Time Conversion Example:
The only alternative is a "pain in the rear" - breaking the time down into seconds.
Excel includes built-in functions to convert a Date/Time into HOUR(date), MINUTE(date), and SECOND(date). Unfortunately, getting the number of days requires calculating the difference between two times: DAYS(end_date, start_date). I used this in the example above for the rows titled Conversion.

Determining the optimal excel chart major unit

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?

Resources