MS Excel - showing restricted time values in y axis - excel

To compute the travel time (across two points) over a period of time, I was logging the time at which I crossed the sub-points between the two main points. My ultimate aim was to prepare a line chart which would show the trend of the journeys, and then find out where I have lost time and where I have gained.
My time entries are in the below format
Day 1|Day 2
09:55|09:35
10:01|09:37
10:06|09:42
10:09|09:45
10:12|09:49
10:15|09:51
10:22|09:58
10:28|10:08
10:35|10:18
10:38|10:21
10:48|10:31
I drew the chart with the time series appearing on the y axis (with journey points on the x axis). But Excel has some logic to determine which time values should be shown in the y axis. How can I force excel to only show the time values which I want to be seen? For example in the above case I actually need time stamps like ;
09:00
09:15
09:30
09:45
10:00
10:15
10:30
10:45
11:00
How can this be done? Thanks in advance.

Found the answer. On the Axis there is a provision to set the Min, Max values, and Major and Minor points on the axis.
For the Min and Max values, divide the hours you wish to see by 24. Example, if the starting time should be 9AM, then 9/24 = 0.375 should be given as the Min value. If 12 noon should be the max value then 12/24 = 0.500 should be given as the Max value. For the Major point, in case the intervals have to be of 15 mins the formula to be used is (15/60)/24 = 0.01041.

Related

Plotting time data as distance between 2 points in Excel

Are there any wizards out there that can help me get a bit closer to the solution regarding this chart I'd like to do for a school project?
I have data regarding transport tasks and how long it took them. I would like to be able to plot them in a way that consecutively shows the length of each trip on the y axis while the x axis represents when the trip happened.
Example of data:
Trip number
Trip Time
Trip Start
Trip Finish
1
06-09-2021 08:28:53
08:28:53
09:14:17
2
06-09-2021 09:00:00
09:00:00
10:21:18
3
07-09-2021 10:30:00
10:30:00
11:30:00
And I would like to chart it in a following way:
You could change the layout of your data to this:
Trip No. Start/Finish
1 08:28:53
1 09:14:17
2 09:00:00
2 10:21:18
3 10:30:00
3 11:30:00
and then plot as a scatter with straight lines with markers chart, selecting each trip as a separate series. Adding each trip as a separate series means the lines should appear between each pair of points and each trip is a separate colour.
The Trip No. column is your x-axis data and the Start/Finish column is your y-axis data.
I have used the trip number rather than the Trip Time column as the x-axis to make the chart easier to read as time + date on the x axis tends to look a bit messy.
It should come out something like this:

Re-arrange Axis of MS Excel 2016 Scatterplot

Software: MS Excel 2016
Files: GitHub Repository
Referring Question: MS Excel Scatterplot converts Months to Numbers
I created scatterplot in month_unordered_axis.xlsx from following data
Then I customized X-axis so it displays only month
Unfortunately the scatterplot (in Chart1 of month_unordered_axis.xlsx) starts with October rather than January.
How to order the X-axis so it displays from January to December?
Your graph is displaying October as the minimum value from its automatic formatting of max/min values. i believe if you scroll up in that formatting window on the right while you have the X-axis selected you will see an option for min and max value. You could set this for the minimum value you in your graph to 36892. This corresponds to the integer value for you lowest date in your series. The unfortunate side effect is that half your circle will be cut off as it extends into the range that is less than your minimum value. You can also set your maximum date to 37256. There are a few other end numbers you can use to give the same results but its essentially the end of December start of January the following year that allow December to be displayed.
Now if you want every month to be displayed (which is independent of placing max min values on your graph), look for the UNITS and Major box. Since you will want ever major line displayed with the name of a month, you will need to make sure the next grid line is a month away. Since not all month are not equal in length you need to play with this number a bit to suit your needs. I started with 30 and wound up with 2 Januaries back to back. However bump it up to 31 and then it tips over into the next month.
The important thing to note here is that you are not actually graphing by months along the X-axis. You are actually plotting by the number of days since January 1st 1900. so January 1st 2001 is 36892 days since January 1st 1900. What excel is doing is counting those days, determine what the date is in a way we like to read it and displaying only the portion we want it to. So for mmmm it the full spelling of the month. And you can see why each grid line being 31 days away is needed to jump into the next month. The kicker is, the grid line is not necessarily the 1st of each month due to the over stepping that is done when you advance 31 days in a month that has 28, 29, or 30 days. and that error gets compounded through the year.
Try using 32 as theMajor Unit step first before putting min and max caps on. (31 resulted in Feb being skipped on my screen). You should still see your axis start before Jan, but your months should all be in order, all displayed and no circles being cut off. Adding the max and min to the axis will cut off your circles but limit the axis to only displaying 12 months.

Calculate time difference between two dates (DD/MM/YYY HH/MM)

In Excel, I have these kind of fields (in the second and the third column):
Fecha/Hora inicio Fecha/Hora finalización
02/01/2017 21:32 03/01/2017 6:02
02/01/2017 6:02 03/01/2017 7:32
03/01/2017 7:38 04/01/2017 13:47
I want to know the time difference between the first and the second field in hours. For instance, in the second case, the difference is 25.5 hours.
I was trying to calculate it manually but I'm sure there is an automatic way.
VBA has a function called DateDiff which measures the difference between two dates in terms of a specified unit (anything from years to seconds). For this case, we will need to measure in minutes because we want to measure fractions of an hour and then divide by 60 to get back to hours. If we only wanted whole hours then we could measure in hours instead.
The following should provide the required result:
MsgBox DateDiff("n", "02/01/2017 6:02", "03/01/2017 7:32") / 60
"n" is the interval specifier for minutes in the DateDiff function

Creating excel graph with 2 variables

I am trying to create a graph in excel (thinking about a scatter graph) with two variables. I have day of the week and and time of day. I would like Day of the Week to be on the Y axis and Time of Day on the x-axis. How can I achieve this?
You need to format the day values as dddd as mentioned in the comment. Here's an example. I have chosen the numbers in the Day column so that if represented as a date they start from Monday.
I also fixed the min and max of the y-axis to 2 and 8, and the min and max of the x-axis to .125 and .75 (because each hour=1/24 of a day so to get an exact number it's easier to work in multiples of 3 hours or 1/8 of a day).

How calculate average time in Excel (if sum of hours more, than 24)

I have some time values like 10:00, 8:50, 9:45 and so on (24 hours format).
I want to know how I can compute average value of this 3 items, if sum of hours more than 24 (if less, then no problems)?
Thanks.
Thanks for everyone. It works, if just type values in cells and try to find average, but it work weird if I use time, which already result of my calculation already. Here screenshot:
Calculating the average of a set of times or list of wind directions could be regarded as similar to computing the average of a set of vectors (values containing both direction and magnitude). It is therefore necessary to equate the time values to their respective positions on a unity circle, derive their perpendicular component values and sum these as is the case for taking the "average" of any such form of cyclic group.
Say you have two times, 23:00 and 01:00, then a normal average calculation (sumproduct/count) will leave you with the incorrect value of 12:00 [(23+1)/2] instead of the correct 24:00 / 00:00 value. If you however regard 23:00 as equal to the vector 1<345° on a twenty-four hour circle and 01:00 equal to 1<15° you can obtain their vector average [cos(345°)+cos(15°) + i*(sin(345°)+sin(15°))] = 1<360° a value equating back to 00:00 on the 24 hour circle.
Note however that this method will cancel out times exactly 12 hours apart, e.g. if you only have 01:00 and 13:00 it is not possible to determine an average time.
I'll just leave you with the formulas then (times in A column)
TIME_TO_DEGREES COSINE SINE
=(360/24)*(HOUR(A2)+MINUTE(A2)/60) =COS(RADIANS(B2)) =SIN(RADIANS(B2))
=(360/24)*(HOUR(A3)+MINUTE(A3)/60) =COS(RADIANS(B3)) =SIN(RADIANS(B3))
=(360/24)*(HOUR(A4)+MINUTE(A4)/60) =COS(RADIANS(B4)) =SIN(RADIANS(B4))
=(360/24)*(HOUR(A5)+MINUTE(A5)/60) =COS(RADIANS(B5)) =SIN(RADIANS(B5))
[C8] [D8]
COMPONENT AVERAGES =AVERAGE(C2:C7) =AVERAGE(D2:D7)
AVERAGE DEGREES DEGREES_TO_HOUR MAGNITUDE
=ROUND(DEGREES(IF(C8=0,ACOS(C8),
IF(D8=0,ASIN(D8),
ATAN(D8/C8)))),3)
+IF(C8<0,180,0)
+IF(AND(D8<0,C8=0),180,0)
+IF(AND(D8<0,C8>0),360,0) =E8/360 =(C8^2+D8^2)^0.5
In the case that the magnitude is zero it is an unfeasible operation to try and compute an average time.
As you would any other numeric values (e.g. using the AVERAGE() function).
Use a formatting mask of:
[hh]:mm
if you want to display more than 24 hours (e.g. for the SUM() function).
Have you tried using the AVERAGE function?
I tested it in excel with your values and it gives me the correct average time.
One method is converting every cell time into seconds , then average these seconds and at last convert to hh:mm:ss format
Simple Just click on Cell(Time) and Converted(Automatic) into 12 hr time
i.e. if you have 00:31:24 then convert it into Full date like this 12:31:24 AM.
After that you can use Average.

Resources