Dividing time to get a percentage - excel

Here's my setup: I'm making a log for a time event I'm doing (think of it like sprinting), with a cumulative time broken up into segmented times, formatted as [hh:mm:ss.000] time values.
What I want to do is figure out how much time of a segment is of the cumulative time in the form of a percentage.
What I'm looking to do is basically do A6(segment)/A10(cumulative time)*100, however that formula obviously doesn't work.

If stop watch times (start at 0 in A1) then try in B2 copied down to suit and formatted as Percentage:
=(A2-A1)/A$10

Related

Excel average if function for obtaining hourly data

I have minute data for air temperature and relative humidity (about 930,000 cells) for a building and I am trying to obtain the hourly average using excels "AverageIF" function. Here's the criteria that I have come up with: whenever one hour passes, average the air temperature and relative humidity for that hour. I am having trouble communicating these criteria to excel and any help would be appreciated. I have included a pic of what my data looks like:
the yellow row is me manually adding a row after an hour has passed and calculated the average using the average function.
In the example above I went a bit long winded in the formula to deal with time intervals where there was no data, as that generates a divide by 0 error.
Essentially what I did was setup a summary table to the right. I gave a start and end time for each hour (ASSUMING this is based on a 24 hour clock and not 1 hour from some arbitrary start time)
I used the AVERAGEIFS function as you have two criteria. Everything after a start time and everything before an end time. Only lines that match BOTH criteria are included.
The basic formula looks like this and is based on my example cell J4:
AVERAGEIFS(E$4:E$31,$C$4:$C$31,">="&$H4,$C$4:$C$31,"<="&$I4)
If the date is important, then you would need to add a date column to the table on the right and add a third criteria to the formula above.
In order to deal with divide by zero error and display blank instead of zero so you can distinguish between actual average of 0 and no data and still presenting an error when another type of error comes up I use the following formula in J4:
=IFERROR(AVERAGEIFS(E$4:E$31,$C$4:$C$31,">="&$H4,$C$4:$C$31,"<="&$I4),IF(ERROR.TYPE(AVERAGEIFS($E$4:$E$31,$C$4:$C$31,">="&$H4,$C$4:$C$31,"<="&$I4))=2,"","ERROR"))
The above formulas can be copied down and to the right.

How to create a lap time and session time format in excel?

I would like to know how to format some cells in Excel for my fuel formula. I created a simple spreadsheet that is used to take the average lap time and total race session time to calculate the amount of fuel needed to finish the race. The formula I wrote works with decimal based numbers but I am wondering if I can make the spreadsheet better by formatting so someone types their actual lap time and session time, MM:SS.split. instead of having to type the times in decimal format which may become confusing
I wrote a function that will give me the correct fuel calculation but I want the cells to be custom formatted for lap times and session times instead of decimals and still show the total fuel needed as a regular number.
=A2*B2
Expected: |1:00|10:00| 10 Laps |
Actual: |1.00|10.00| 10|
If you are not going to perform any calculations on these numbers, then you can use the formula TEXT(). For the times, you can use something like the below where m means minutes and s means seconds and 1440 is 24 hours*60 minutes (1 in excel is equivalent to 1 day, so you need to divide by 1440 to make a day become a minute):
=TEXT(A1/1440,"mm:ss")
And the below for the laps:
=TEXT(A1, "#"" Laps""")
But if you have to perform calculation on these numbers, then you will have to format the cells directly instead of using the formula (Home > Format > Format Cells > Custom (Under General, or Ctrl+1 on the cell) and use the formatting I used in the text formula, i.e. mm:ss and # "Laps" respectively. For the times however, you will have to manually divide by 1440.
Have you tried changing the data type of the cell to Time?

How do i Subtract a duration from a time in Excel?

I am having an issue with Excel and it’s probably very simple but I need to get a starting time by subtracting a duration from and end time.
For example say I know that an event needs to end at 1:55:23 pm and it will take 0:22:13 what formula would I use to find out what time I should start?
I would like to be able to input the duration in the format h:mm:ss without excel trying to turn it into a time and not a duration as well.
Thank you for any suggestions
You simply subtract them.
For example...
Cell A1 has the end time: 1:55:23 PM
Cell B1 has the duration: 0:22:13 (this is the only 'strange' part because it's actually an AM time, as in minutes after midnight... but if you think about it, that's what you want).
Cell C1 has this formula: =A1-B1
That's it.
NOTE: If your duration is longer than your event start time (for example, a 4-hour event that started at 3:00 in the morning!) then the subtraction would result in a negative time.
A negative time is OK in reality, but Excel will not display it as a formatted time... instead it displays a bunch of ############. In that case, you need to display the calculation as a decimal value, which is the fraction of a day. For example. 0.25 means exactly 6 hours. If you would prefer decimal hours you simply multiply the fractional day figure by 24.

Divide Time Period across different Time Frames (Calculating Interest)

In the attached excel file
http://www.sendspace.com/file/y9qj0t
I've got a time period "C3:D3" (time periods can be altered by user) and a sum of money for which i need to calculate interest across different time periods with different interest rates.
You can check out my formula in "E6:E" but somehow I'm not postive it's correct.
I want the formula to divide days of the above period of time across the different int. rates time frames & return "0" when int.rates times frames are before or after my time period.
Also, I'm not certain how to handle the last int. rate time frame (ie the last time int. rate was changed so it's not a closed time frame B50:C50). B50 is occupied by the last date int. rate was changed and C50 equals above mentioned D3. Does it make any sense?
Thanks for any help!
I was going to answer your previous question....but you deleted it...
Your method works, I think, but this formula can give you the correct result in a single cell without using columns E and F
=SUMPRODUCT(LOOKUP(ROW(INDIRECT(C3&":"&D3-1)),B6:D50))/365*E3
it doesn't matter what value you put in C50
The ROW/INDIRECT part gives you an "array" of all dates from C3 to D3-1 and that array is the lookup value for LOOKUP function, looking up each date in B6:B50 and returning the corresponding rate from D6:D50. SUMPRODUCT then sums all those rates. Diving by 365 then gives you the average annual rate. I get 2.89 for your example, the same as your result

Working with time DURATION, not time of day

I'm doing some benchmarking, and I want to use Excel to produce graphs of the results. I've got a simple but annoying problem which is baking my noodle.
The problem is that Excel insists that "time" means a time of day. It refuses to let me work with time durations. When I try to say "three minutes and six seconds", it misinterprets this as "three minutes and six seconds past midnight", which isn't what I meant at all.
I can work around the problem by laboriously converting everything to seconds. But then all my graphs are labelled in seconds, not minutes and seconds. Plus it's a pain to have to keep typing in =3*60+6 rather than just 3:06. And once I've done it, I have to look at the formula to check whether I entered the data correctly [and didn't screw up the formula].
Does anybody know how I can make Excel work with a time duration not anchored to a specific time of day?
You can easily do this with the normal "Time" data type - just change the format!
Excels time/date format is simply 1.0 equals 1 full day (starting on 1/1/1900). So 36 hours would be 1.5. If you change the format to [h]:mm, you'll see 36:00.
Therefore, if you want to work with durations, you can simply use subtraction, e.g.
A1: Start: 36:00 (=1.5)
A2: End: 60:00 (=2.5)
A3: Duration: =A2-A1 24:00 (=1.0)
Use format d "days" h:mm:ss or [h]:mm:ss, depending on your needs.
Say you have a duration of 30h 12m 54s:
h:mm:ss -> 6:12:54 (not correct for a duration)
[h]:mm:ss -> 30:12:54
d "days" h:mm:ss -> 1 days 6:12:54
Variations are possible: I like something like d"d" h"h" mm"m" ss"s" which formats as 1d 6h 12m 54s.
The custom format hh:mm only shows the number of hours correctly up to 23:59, after that, you get the remainder, less full days. For example, 48 hours would be displayed as 00:00, even though the underlaying value is correct.
To correctly display duration in hours and seconds (below or beyond a full day), you should use the custom format [h]:mm;# In this case, 48 hours would be displayed as 48:00.
Cheers.
With custom format of a cell you can insert a type like this: d "days", h:mm:ss, which will give you a result like 16 days, 13:56:15 in an excel-cell.
If you would like to show the duration in hours you use the following type [h]:mm:ss, which will lead to something like 397:56:15. Control check: 16 =(397 hours -13 hours)/24
I don't know how to make the chart label the axis in the format "X1 min : X2 sec", but here's another way to get durations, in the format of minutes with decimals representing seconds (.5 = 30 sec, .25 = 15 sec, etc.)
Suppose in column A you have your time data, for example in cell A1 you have 12:03:06, which your 3min 6sec data misinterpreted as 3:06 past midnight, and column B is free.
In cell B1 enter this formula: =MINUTE(A1) + SECOND(A1)/60 and hit enter/return. Grab the lower right corner of cell B2 and drag as far down as the A column goes to apply the formula to all data in col A.
Last step, be sure to highlight all of column B and set it to Number format (the application of the formula may have automatically set format to Time).
Highlight the cell(s)/column which you want as Duration, right click on the mouse to "Format Cells". Go to "Custom" and look for "h:mm" if you want to input duration in hour and minutes format. If you want to include seconds as well, click on "h:mm:ss". You can even add up the total duration after that.
Hope this helps.
The best way I found to resolve this issue was by using a combination of the above. All my cells were entered as a Custom Format to only show "HH:MM" - if I entered in "4:06" (being 4 minutes and 6 seconds) the field would show the numbers I entered correctly - but the data itself would represent HH:MM in the background.
Fortunately time is based on factors of 60 (60 seconds = 60 minutes). So 7H:15M / 60 = 7M:15S - I hope you can see where this is going. Accordingly, if I take my 4:06 and divide by 60 when working with the data (eg. to total up my total time or average time across 100 cells I would use the normal SUM or AVERAGE formulas and then divide by 60 in the formula.
Example =(SUM(A1:A5))/60. If my data was across the 5 time tracking fields was the 4:06, 3:15, 9:12, 2:54, 7:38 (representing MM:SS for us, but the data in the background is actually HH:MM) then when I work out the sum of those 5 fields are, what I want should be 27M:05S but what shows instead is 1D:03H:05M:00S. As mentioned above, 1D:3H:5M divided by 60 = 27M:5S ... which is the sum I am looking for.
Further examples of this are:
=(SUM(G:G))/60 and
=(AVERAGE(B2:B90)/60) and =MIN(C:C) (this is a direct check so no /60 needed here!).
Note that your "formula" or "calculation" fields (average, total time, etc) MUST have the custom format of MM:SS once you have divided by 60 as Excel's default thinking is in HH:MM (hence this issue). Your data fields where you are entering in your times should need to be changed from "General" or "Number" format to the custom format of HH:MM.
This process is still a little bit cumbersome to use - but it does mean that your data entry is still entered in very easy and is "correctly" displayed on screen as 4:06 (which most people would view as minutes:seconds when under a "Minutes" header). Generally there will only be a couple of fields needing to be used for formulas such as "best time", "average time", "total time" etc when tracking times and they will not usually be changed once the formula is entered so this will be a "one off" process - I use this for my call tracking sheet at work to track "average call", "total call time for day".
Let's say that you want to display the time elapsed between 5pm on Monday and 2:30pm the next day, Tuesday.
In cell A1 (for example), type in the date. In A2, the time. (If you type in 5 pm, including the space, it will display as 5:00 PM. If you want the day of the week to display as well, then in C3 (for example) enter the formula, =A1, then highlight the cell, go into the formatting dropdown menu, select Custom, and type in dddd.
Repeat all this in the row below.
Finally, say you want to display that duration in cell D2. Enter the formula, =(a2+b2)-(a1+b1). If you want this displayed as "22h 30m", select the cell, and in the formatting menu under Custom, type in h"h" m"m".
What I wound up doing was: Put time duration in by hand, e.g. 1 min, 03 sec. Simple but effective. It seems Excel overwrote everything else, even when I used the 'custom format' given in some answers.

Resources