This question already has answers here:
1 microsoft second = 0.00001157407407
(3 answers)
Closed 4 years ago.
I have a column of time values in excel that are from exporting from another piece of software. The time is formatted as hh:mm:ss.sss (e.g. 00:00:02.147 -> 0 hrs, 0 min, 2 s and 0.147 ms).
I want to change this into total number of seconds in excel however any function performed on the cells results in a #VALUE! error. I have tried changing the cell type from General to Text to Time to Custom (i.e. [ss]) etc. however nothing has worked. Is there anyway I can do this? This also causes issues for plotting in python.
The custom format of "hh:mm:ss.000" should do what you are after.
You can then narrow that down to "ss.000" and just use =A1 or even just nab the seconds with =SECOND(A1) (if you wanted to do this long-hand then you can do a =RIGHT(A1,6) with a format of "ss.000" or even =TEXT(A1,"ss.000") / =TEXT(RIGHT(A1,6),"ss.000").
The issue being that using "ss.sss", excel is trying to append seconds on to time again rather than milliseconds, so if excel can first know the milliseconds exist you should be able to extract the seconds.
EDIT
If it's the total number of seconds you are after, multiply the DateTime value by the number of seconds in a day: =A1*86400
Related
So I am trying to find my average time in Excel and I have been using the average function but even though I do not know what the exact value should be I know that what was being returned was way off. So I googled Excel time format and followed the instructions and changed my time from MM:SS format to H:MM:SS format; because the article said that way I am guaranteed to get correct averages when I use Excel's native average function.
However, I am running Excels average function on mixed values like the below:
1:20:30
0:04:00
0:00:30
0:00:05
--------
Average: 0:21:16
Can someone just please share their expertise with me and verify that the above average calculation is correct that I obtained by just easily using Excel's native average function.
I just want to be sure before I change everything on my spreadsheet.
Working with times and their various formats/representations can be tricky in Excel - sometimes I convert to serial and then multiply by 24 to ascertain the number of hours in the day, other times not. In your case, this appears to be straight forward and can easily be verified.
Here/screenshot refer:
Mathematically: you can determine the number of hours, minutes, seconds directly from what you have using respective equations as follows:
=hour(E4)
=minute(E4)
=second(E4)
Determining the average is then a trivial exercise by summing and dividing by the count (4), which reconciles (as can be seen).
Let's apply logic too: average of 21 mins looks about right - consider equivalent scenario of average running time for 4 athletes, where one of them takes 80 mins and the others take under 5 each - average time will be around 20 mins (~80/4).
I have been collecting data over the past few data from an energy metering project i have set up.
The values that are recorded are saved in a CSV file and then extracted through usb drive.
i have opened and assessed the CSV file in excel and the data hasnt been recorded how i would like.
Instead of logging once every minute it has logged every 7 seconds.
This has created a problem as the template csv file i have created to average these figures wont work now.
i am trying to create a VBA marco to assess all the data and where the second value is higher then 6 seconds, i want it to delete it for example:
here is some of the values i am working with:
16:29:05 PAC3 239.8030701 50.01350021 1073.719116 4.450771332 0
16:29:05 PAC2 239.2398834 50.01499939 3046.500732 12.62684536 0
Above is how i would like it to look.
but it currently looks like below where there are several entries under the 16:30 time
16:30:02 PAC3 239.6912689 50.06306076 1092.592651 4.229027748 0
16:30:02 PAC2 238.8809052 50.06230927 3535.760254 14.82234478 0
16:30:09 PAC3 239.8191681 50.07057571 999.7850342 4.125905514 0
16:30:09 PAC2 239.2037506 50.06982422 2644.371338 11.05446911 0
because it is logging every 7 seconds i am getting about 7 - 8 logs per minute per PAC
so where the second value is greater than 6 seconds i would like the whole row to be removed. and continue to cycle through the entire column and remove them. These cells are formatted into a time format but do contain a time and data value
I have searched for ways to complete this task but have found no solutions
any help appreciated.
If you use =SECOND() function you can extract the seconds from the time value. Then loop up the column starting at the bottom and delete the rows that contain the values you don't want.
This question already has an answer here:
Converting large time format to decimal in excel
(1 answer)
Closed 5 years ago.
I have a function =TIME(8,30,0)-(C2-B2) that work out my timesheet for me but I also need the resulting elapsed time value to be converted into hours and 100ths of an hour.
e.g. 1:45:00 would be 1.75.
Multiplying the result by 100 and dividing by 60 does not seem to give the desired result.
Time in Excel is a decimal. so one hour is 1/24th of a full day. So 1/24.
Multiply the time by 24 and you will get your decimal:
=A1*24
In an Excel 2003 spreadsheet, I have the top row of cells calculating the number of days and hours I have worked on something based on data I put in the cells below for each category. For example I enter the time spent on Programming, Spoken languages, house, piano, guitar...etc. The top cell in each category will keep track of and display how many days and hours I spent as I add the time spent for each category each day. I want to evaluate this top row and then list in a "report" (like a pop up box or another tab or something) in order from least amount of time to the most amount of time. This is so I can see at a glance which category is falling behind and what I need to work on. Can this be done in Excel? VBA? Or do I have to write a program from scratch in C# or Java? Thanks!
VH
Unbelievable... I've been scolded for trying to understand an answer and requested to mark this question answered. I don't see anything to do this and could not find anything that tells you how, so I'm just writing it here. MY QUESTION WAS ANSWERED... But thanks anyway...
Consider the following screenshot:
The chart data is built with formulas in columns H3:I3 and below. The formulas are
H3 =INDEX($B$3:$F$3,MATCH(SMALL($B$2:$F$2,ROW(A1)),$B$2:$F$2,0))
I3 =INDEX($B$2:$F$2,MATCH(SMALL($B$2:$F$2,ROW(A1)),$B$2:$F$2,0))
Copy down and build a horizontal bar chart from the data. If you want to change the order of the source data, use LARGE() instead of SMALL().
Alternative Approach
Instead of recording your data in a matrix, consider recording in a flat table with columns for date, category and time spent. That data can then easily be evaluated in many possible ways without using any formulas at all. The screenshot below shows a pivot table and chart where the data is sorted by time spent.
Edit after inspecting file:
Swap rows 2 and 3. Then you can choose one of the approaches outlined above.
Consider entering the study time as time values. It is not immediately clear if your entry 2.23 means 2 hrs and 23 minutes, or 2 hrs plus 0.23 of an hour, which totals to 2hrs, 13 minutes.
If you are using the first method, then all your sums involving decimals are off. For example, the total for column B is 7.73 as you sum it. Is that meant to be 7 hrs and 73 minutes? That would really be 8 hrs and 13 minutes, no? Or is it meant to be 7 hrs and 43 minutes? You can see how this is confusing. Use the colon to separate hrs and minutes and - hey - you can see human readable time values and don't have to convert minute values into decimals.
This question already has answers here:
Convert decimal day to HH:MM
(3 answers)
Closed 3 years ago.
I have a dataset that encodes a date-time into two separate variables. Normally, I'd just paste them together inside of an as.POSIXct and carry on. However, the date is provided as a string, and the time of day as a fraction of 24 hours - e.g., 12pm is 0.5, 9:30am is 0.1458333, etc.
It doesn't seem all that tricky to convert the fractional days into clock hours, but I'd prefer to use a pre-existing function if possible. Does something like that exist in base R? A package?
If it's any use, this is an Excel (xlsx) time field imported into R through RODBC.
EDIT
Oddly enough, upon revisiting this problem, the times are now read in as POSIXct. Not sure what to make of that.
The R News 4/1 Help Desk article has a section on reading Excel dates in R.
POSIXct values are simply the number of seconds since midnight GMT 1970-01-01. (So you need to pay attention to your offset from UTC.) You can use the date part and add the number of days times 24*3600 (as.Date(dtval) to your time value * 24*3600. Gabor pointed to the article in R News (which he wrote, thank you, Gabor.)
You didn't give an example of the string. If you are getting your date as a string, then as.Date(strDate) will convert a variable "strDate" to Date class when it is in either "YYYY-MM-DD" or "YYYY/MM/DD" format. Otherwise the formatting codes are on the ?strptime page.
Once you have a POSIXct-classed variable you can just add the number of seconds. This example add 30 minutes to midnight today Feb 1, 2011 (in my time zone which is UTC-5):
> as.POSIXct(as.Date("2011-02-01")) +30*60
[1] "2011-01-31 19:30:00 EST"
And this is your time value added to midnight my time:
> as.POSIXct(as.Date("2011-02-01 00:00", tzone="UTC"))+3600*5 + 3600*24*timeval
[1] "2011-02-01 03:29:59 EST"