Excel Time Formula - excel-2007

I have the following formula:
=IF(MROUND(((D4-C4+IF(C4>D4,1)-INT(D4-C4+IF(C4>D4,1)))*24), 0.25) < 0.15, 0.25, MROUND(((D4-C4+IF(C4>D4,1)-INT(D4-C4+IF(C4>D4,1)))*24), 0.25))
this formula gets the time between a start and stop time and rounds it up to the nearest 15 minutes. I have a problem with it when no time is entered and it = 15 minutes.
If anyone can help so it says 0 or even a less complex solution that would be great thank, I am thinking a macro what does everyone think?

The formula as written says:
If the first term occurs later than the second one, assume that the first term occurs the next day.
Ignore any day information (invalidating the last point).
If the difference in hours rounded to the nearest fifteen minutes is less than 0.15 of an hour (9 minutes), return fifteen minutes, else return said difference.
So if you want for it to give zero if neither time is entered, just simplify the formula like this:
=MROUND(24*MOD(A14-C14,1),0.25)
which gives zero if the difference is between 0 and 7.5 minutes (Excel just assumes that an empty cell is zero, midnight in this case), otherwise it gives the same results.

Related

DateDiff into Hours and have decimals

I have two times periods from the same day and I am using datediff(Hour,FirstTime,SecondTime)*1.0 to get the hours difference, but it is rounding. I am expecting 4.5 but my results keep coming back as 5.0
I tried casting each time, formatting each time before datediff but the results are the same. I know I am missing a simple solution probably because I am too close to the issue.

Google Bigquery table decorators

I need to add decorators that will represent from 6 days ago till now.
how should I do it?
lets say the date is realative 604800000 millis from now and it's absolute is 1427061600000
#-604800000
#1427061600000
#now in millis - 1427061600000
#1427061600000 - now in millis
Is there a difference by using relative or absolute times?
Thanks
#-518400000--1
Will give you data for the last 6 days (or last 144 hours).
I think all you need is to read this.
Basically, you have the choice of #time, which is time since Epoch (your #1427061600000). You can also express it as a negative number, which the system will interpret as NOW - time (your #-604800000). These both work, but they don't give the result you want. Instead of returning all that was added in that time range, it will return a snapshot of your table from 6 days ago....
Although you COULD use that snapshot, eliminate all duplicates between that snapshot and your current table, and then take THOSE results as what was added during your 6 days, you're better off with :
Using time ranges directly, which you cover with your 3rd and 4th lines. I don't know if the order makes a difference, but I've always used #time1-time2 with time1<time2 (in your case, #1427061600000 - now in millis).

How to calculate punctuality in SQL

I have two times : actual_arr and sched_arr. Both times are in the format char (YYYYMMDDHH24MISS).
Now I've to calculate the punctuality of each movement. The rows are stored as below :
MovtName Actual_Arr Sched_Arr
mvt1 20140206215900 20140206210000
Now my definition of punctuality is (in percentage) : (actual time - sched time)/sched time*100.
I know how to calculate the difference for each movement. The code snippet I used is :
Trunc((To_Date(actual_arr,'YYYYMMDDHH24MISS')-To_Date(sched_arr,'YYYYMMDDHH24MISS'))*24*60,2)
This gives the delay in minutes.
Now what do I divide this value with? This is what I cannot wrap my head around. How do I convert the sched_arr into minutes? Or in other words what is the valid denominator for the equation for punctuality?
If anybody has a more correct definition for punctuality and how to calculate it, I'm all ears.
Thanks in advance.
For a single meeting, just use the lateness in minutes as a measurement of punctuality.
When you have multiple meetings you can start to define punctuality in non-dimensional terms, such as the percentage of meetings which started more then five minutes late.

Finding maximum input (time complexity)

Assume a computer operating at 1GHz speeds — i.e. it executes 10^9 instructions/second. For each of the following time complexities, what is the largest size input n that could be completely processed in 1 week?
a) n²
b) n³
c) 2^n
This is homework. I don't need the answer I just don't know how to start the problem. Can someone please show me how to solve the first one. I could then figure out the rest. Thank you!
The way I see it is take 10^9 and subtract 10² to get the maximum input but that seems too easy.
60 seconds in a minute, 60 minutes in an hour, 24 hours in a day, 7 days in a week. That's 604800 seconds.
If you can execute 10^9 instructions per second, you can execute 604800*10^9 instructions per week - that's 6.048*10^14.
The square root of 6.048*10^14 is 24,592,681, i.e. we can process 24,592,681^2 instructions in a week, so we can process 24,592,681 sized input if it is n^2 time complexity.
The rest are pretty similar.

Check for minutes not evenly divided by 5

I have a time stored as a decimal(9,2) column in an sql-server 2005 database.
The time is represented like
Time timeInDecimal
1H 20Min 1.33
1H 30Min 1.50
and so on
I´m looking for an easy way to check whether the number of minutes except whole hours is not evenly divided by 5.
The value I'm hoping to find is where the time is 1H:23Min but not 1H:25MIN.
I just wan´t to compare the minute part of the time.
The way I do now is:
RIGHT(CONVERT(varchar(5),DATEADD(minute,ROUND(timeInDecimal * 60,0),0),108),1) not in ('0','5')
But it does hardly seems to be the ideal way to deal with this.
Feels like I can use the modulo operator for this, but how?
Or is there an even better way?
Hope for a quick answer.
Kind Regards
Andreas
Using the modulus operator, twice:
ROUND((timeInDecimal % 1) * 60, 0) % 5 <> 0
That will:
Get the fractional part and convert it to minutes.
Round it to the nearest minute (.33 hours -> 20 minutes, not 19.80).
Check whether that's divisible by 5.