Excel Time Formatting - excel

So, I have an app, which automatically creates Excel tables. One of the column in those tables is something like a duration for a task. The format of the data looks like this: "1h12min" or "5min".
Now I want to be able to sum up all those numbers and have a total duration of all tasks.
I have tried using custom cell formatting, but I wasn't able to solve the problem that way, mostly because all time formats require a certain input method (like 00:00) and using '#' for the minutes resulted in them stacking up to 100 instead of 60.
I was gonna try an approach where I create one or more extra columns that convert those numbers into time format with the help of stuff like IF and CONTAINS functions, but my attempts are not working out.
Does anyone know of a good way to solve this problem?? Thanks in advance!

So this was my example:
So, cell DK8 contained "9 mins 18 secs".
The result "9.30"
And the function:
IFERROR(IF(ISERR(FIND("sec",DK8,1)),LEFT(DK8,FIND(" ",DK8,1)-1),LEFT(DK8,FIND(" ",DK8,1)-1)+(MID(DK8,FIND(" ",DK8,FIND(" ",DK8,1)+1)+1,FIND(" ",DK8,FIND(" ",DK8,4)+1)-FIND(" ",DK8,FIND(" ",DK8,1)+1)))/60),"")
You will need to edit to suit for hours etc

Related

sum up days using only existing Excel formulas

I would like to sum up date periods and sum the days per item.
The input data will grow over time and new item categories can appear, so the items (number of rows) that show in the expected report can not be "hardcoded".
The input parameter is the from and to date that determines the period that must be considered. You can imagine this as a moving date window on the input data grid.
I am a Java programmer and I am sure that I can write a proper SQL that groups and sums the data and generate the result. And I can write a Java program too, that does the job, but I really want to do this calculation from Excel.
Is there any way to generate the report by using only a combination of existing MS Excel formulas without writing any Visual Basic code (macro)?
If yes, then could you please put me in the right direction and tell me which formulas I can use? Then I can figure out how to use the formulas.
I hope that this helps to understand better what I would like to have:
Try:
Formula in F3:
=SUM(COUNTIFS(C:C,E3,A:A,"<="&SEQUENCE(H$2-F$2,,F$2),B:B,">="&SEQUENCE(H$2-F$2,,F$2)))
Note that range references that take whole columns will take long to process all data. The above will work even with overlapping dates.

How to take number input and convert to time in excel

I am making an airplane reservation system on java. i got a sample database from online. only problem i have is the way the time is inputted.
and some times are 917 , or 22 , or 2. there is no 0 so i cannot just try and put a semicolon after 2 spaces.
Any one know if their is a way to do this, or some work around.
You can try:
=--TEXT(A1,"00\:00")
and format the result as "Time"
Edit:
I note you have changed your specifications to include that the times may be entered as the hour only: eg: 2 or 22. Try the revised formula below to handle that:
=--TEXT(IF(A1<=24,A1&"00",A1),"00\:00")
You can use the following formula:
=TIME(LEFT(A2,LEN(A2)-2),RIGHT(A2,2),)
A2 = the arrival time cell that you want to convert.
Also, make sure to change your output column to whatever time format you're looking for. Screenshot of results in action included.

finding time difference with 1 cell

I recently pulled a huge amount of data into a csv file, as a result a large amount of data is being formatted like this:
xx:xx-xx:xx - 'text'
The problem i'm having is this is all in one cell, I've tried looking online without much luck so basically wanted to know if it's even possible to find the time difference between xx:xx-xx:xx even if they're stored on the same cell? If not, is there a way to split these times into different cells en mass?
edit:
I've managed to remove the text from the cell, I now am left with 1 cell containing ranges similar to:
Please try, formatted as Time:
=MID(A1,7,5)-LEFT(A1,5)
If that does not work then check for leading spaces. Won't suit if times are late/early order, nor if spanning midnight.
Edited so there should be no need to strip out 'text'.

MS Excel Time Format (Not Function)

I am having a problem with Excel's time format. I am trying to log amount of time spent on things. (and i want to be lazy) I try logging the time and excel converts it to a date. I know why it does this, but not how to stop it. I have even tried a custom format so that excel wont convert it, but excel somehow overrides my customization. Im trying to log four minutes and 24 seconds. i have tried doing 00424, 000424, 424, and a few others. I have tried 4:24 and excel changes that to 24:00. like i said, i have tried customization and i have tried pre-made formats, but nothing fixes it. Preferably i'd like to be lazy and just type in 424 and have it converted to 4:24. Any help?
Thanks, Greg
Use two columns, A where you enter values, B where you display them.
In B1 and below put:
=(INT(A1/100)*60+MOD(A1,100))/60/60/24
Then format column B as custom M:SS
Change the formatting of the cell to "Text" .. then type whatever you want: ie "4:24", "424", "0424", etc all work. No fancy formatting, but the data is in. Next, take the next cell and parse/format it (again in text) the way you want: So if you're input is simply "424" (in A1) as you want ... just do a: =concatenate(mid(a1,1,len(a1)-2),":",mid(a1,len(a1)-1,2))

How to optimize COUNTIFS with very large data

I would like to create a report that look like this picture below.
My data has around 500,000 cells (it will continue to grow larger)
Right now, I'm using countifs function from excel but it takes a very long time to calculate. (cannot turnoff automatic calculate)
The main value is collected as date and the range of date is about 3 years, so I have to put a lot of formula to cover all range of value.
result
The picture below is the datasource the top one cannot be changed. , while the bottom is the one I created by myself (can change). I use weeknum to change date to week number.
data
Are there any better formula or any ways to make this file faster? Every kinds of suggestions are welcome!
I was thinking about using Pivot Table, but I don't know how to make pivot table from this kind of datasource.
PS. VBA is the last option.
You can download example file here: https://www.mediafire.com/?t21s8ngn9mlme2d
I will post this answer with the disclaimer that it is entirely dependent on the size of the data set. That turning on and off the auto calculate is the best way, but your question doesn't let me do that, so keep reading.
Your question made me curious, so I gave it a try and timed it. I essentially set up two columns of over 100,000 rand numbers choosing from 1-1000 and then tried to do a countif on the two columns if they were equal. I made a macro that I can run that turns off the autocalculate, inserts the start time, calculates, and then inserts the finish time. I highlighted in yellow the time difference.
First I tried your way, two criteria, countifs:
Then I tried to combine (concatenate) the two columns to see if I could make it easier by only having one countif criteria and data set. It doesn't. see result below:
Finally, realizing what was going on. I decided to make the criteria only match the FIRST value in the number to look for. I was essentially reducing the number of characters to check per cell. This had a positive result. See below:
Therefore my suggestion is to limit the length of the words you are comparing in anyway possible. You are mostly looking at dates, so you might have to get creative, but this seems to be the best way possible without going to manual calculation.
I have worked with Excel sheets of a similar size. Especially if you are using the data on a regular basis, I would heartily recommend switching to a proper database SQL based, Access, or whatever fits your purpose. I does wonders for the speed and also you won't run into the size limits of Excel. :-)
You can import the data you have now fairly easy.
I am happy as a clam with my postgresql db.

Resources