convert, round, and multiply/divide in excel - excel

We're doing an overtime incentive where people can earn raffle tickets based on the number of extra hours they work. They earn one ticket for every seven hours of overtime they work. I've built an excel sheet that I can just import the total hours into to track this, but I'm having trouble with the "number of tickets earned" formula.
I have a column for the number of hours over 40 worked, then a column to convert the hours to a number then divide by seven using: =((C2-INT(C2))*24)/7. Next column, I have =ROUNDDOWN(D2, -0.5) because if they worked 15 hours, it was giving them 2.5 tickets.
The issue I'm running into is that when they worked exactly 7 hours, I get 0 for the =ROUNDDOWN(D2, -0.5) formula. I tried =ROUND(D18, -0.5) but if they worked 6 hours 30 minutes, it gives them one ticket. I'm sure I'm probably missing something simple but is anyone able to help?

You have already used INT, which would be a better option than ROUND or ROUNDDOWN. Also C2-INT(C2) can be simplified to MOD(C2,1):
=INT(24*MOD(C2,1)/7)
Breaking it down:
MOD(C2,1) take the decimal portion of C2 (i.e. Hours, less than 24)
24*MOD(C2,1) convert from fraction-of-day to full hours
24*MOD(C2,1)/7 divide by 7. For 6.5 this gives 0.928... and for 15 it gives 2.142...
INT(24*MOD(C2,1)/7) take only the Integer part. For 6.5 this gives 0, for 15 it gives 2

I think your problem is the -0.5 argument of the ROUNDDOWN function. Why do you want to round to negative one half decimal places?
Just use ROUNDDOWN(D2,0).
Edit: I'm not sure why Agent 7 and Agent 8 have different numbers of tickets if they both worked exactly 7 hours overtime. Is the 7:00 a rounded number?

Assuming overtime is in column C, you could use:
=ROUND((HOUR(C1) + IF(MINUTE(C1)<30,0,1)) / 7, 0)
This should yield the correct number of tickets if you want to round up the hour when they are over 30 minutes. Otherwise, you could just take out the IF / MINUTE section and it will only count complete hours.

Related

Excel - Dividing total to a range of cells

I have a issue with my excel project. What I want to do is to divide number of working hours to cells when particular person has a working day. Right now I use QUOTIENT formula with combination with others but the problem is I'm not getting the right split of the total. So set up looks like that
Number of hours = 72
Number of Working days = 7
So I need to divide 72/7 but I need to have the result rounded to full figure (hour). So for example I need day 1 = 10h day 2=12h and day 3 to 7 each = 10h. The QUOTIENT is resulting 10h in every single day giving me result of total 70 not 72.
The problem is that the variables will change when the employee will be switched so for example the next employee will have 94 hours and 11 days. Generally its look like that that I have range of full month so from 1 to 31 and the working days are collected from "working schedule". The idea is to sum up the hours to a month normative working hours. So for example employee has 104 hours and he is working 12 days in working schedule but the monthly norm is 176 so we have 72 hours missing and those hours should be added to those days that he is working.
Example.
You can use MOD function to calculate the remainder.
so day 1 and 3 to 7 should have =quotient(72,7)
and day 2 should have =quotient(72,7)+mod(72,7)
I suppose from your question that you want the remaining hours to be added to day 2.

Trying to Sum negative times

I am trying to sum two cells that have hh:mm's in them. Some of these cells may start with a + that I have removed but other are negative.
The highlighted cell has this formula in it.
=SUM(IF(LEFT(R6148,1)="+",RIGHT(R6148,LEN(R6148)-1),R6148),IF(LEFT(R6149,1)="+",RIGHT(R6149,LEN(R6149)-1),R6149))
What I was expecting is that under home 1 will be -05:00 and so on for the other homes.
Thanks
If the Time is Text then you can convert this using below formula then sum it:
=LEFT(A1,SEARCH(":",A1)-1)-(MID(A1,SEARCH(":",A1)+1,2))/69
Excel can't handle negative times, so these cells are presumably either text cells or use a single quote in front of the operator. You need to convert them to numbers before doing the math.
I would suggest separating the operator (+ or -) from the string, converting the hours to a number, and then recombining the operator and the hours. Because you're converting a time in hours to a number, it will be returned as a fraction of a whole day (e.g., 1 hour = 1/24 = 0.0416667), so you would multiply tit by 24 to get back to hours.
=(NUMBERVALUE(LEFT(B2,1)&NUMBERVALUE(RIGHT(B2,LEN(B2)-1)))+NUMBERVALUE(LEFT(B3,1)&NUMBERVALUE(RIGHT(B3,LEN(B3)-1))))*24
A better solution may be to convert all values to decimal numbers instead of times. You'd have to enter minutes as a decimal (e.g., 1 hour and 15 minutes = 1.25 hours), which could be tough for folks to do on the fly without a calculator, so you could provide a helpful conversion table from minutes to decimal hours. Timekeeping is often limited to some minimum interval, so the conversion table could be pretty short (e.g., if it's a minimum 5 minute interval, you only have 11 possible values for 0 minutes through 55 minutes).

rounding cells up when the number hits X.60

I'm making something in excel which calculates my hours I work a week/month, when a number gets to 30.60 (two shifts which when finishing on the half an hour) it calculates it as 30.60*wage=not the right pay.
so far I have =ROUND(SUM(C6:I6),0) which rounds up the number, which works fine until I have another day which I work till half an hour then it will just show 16 or so.
As you can see here, it calculates it fine until I work 7.30 hours on a wednesday, the total shows 23.00 instead of 23.30.
How can this be done.
Thank you.
your problem is with excel understanding of your "hours". When you write 7.30 you mean 7 hours 30 minutes = 7.5 hours. But excel understands that as 7 hours and 30/100 of hour = 18 minutes. The easiest solution would be to use 7,5 for 7 hours 30 minutes.
(for sake of checking the question off the unanswered I copied my comment)
If you don't want to use 7.5 (Seven-and-a-half-hours) or 7:30 (7 hours, 30 minutes - but remember to multiply this by 24, since Excel stores this as the fraction of a day, 0.3125) then you can use INT and MOD:
=INT(C6)+(MOD(C6,1)/0.6)
The first part, INT(c6) will give you the Integer part (i.e. whole hours) which we don't want to scale/skew.
The second part has 2 stages. First, MOD(c6,1) will give us the Decimal part of the number (i.e. 7.3 will become 0.3) and the second part is to divide by 0.6 to convert from "fake-minutes" to "fraction-of-real-hour"
Finally, since you want to apply the formula to an array of cells, you will need to swap from SUM to SUMPRODUCT:
=SUMPRODUCT(INT(C6:I6)+(MOD(C6:I6,1)/0.6))
But, overall, best option is to use 7:30 and set Data Validation only allow actual Time values in that field.
{EDIT} Of course, this will give your output with 0.5 for 30 minutes. If you want to reverse back to 0.3 for 30 minutes (although, I can scarcely fathom why) then you need to run the same calculation in reverse:
=INT(SUMPRODUCT(INT(C6:I6)+(MOD(C6:I6,1)/0.6))) + 0.6*MOD(SUMPRODUCT(INT(C6:I6)+(MOD(C6:I6,1)/0.6)),1)

Formula to get the worked hours from time A to time B where B is past midnight

I'm using Excel to write down my shifts and get a total of worked hours per day and per week.
I structured it this way:
Everything seemed to work fine until I finished to work at 12.30 am. The result with my formula was -17 hours instead of 7. How can I fix my formula so that it displays a correct amount? I'm using the following formula and I want the result to be displayed in number format, not time.
=IF(C11=0,0,IFERROR(((C11-B11)-D11)*24,0))
What formula can I use?
Excel treats days as 1 for every day past Dec 31, 1899. Today happens to be 42,217. Time is nothing more than a decimal portion of a day. Today at noon was 42,217.5 and tomorrow at 03:00 will be 42,218.125.
Excel also treats boolean (e.g. TRUE/FALSE) values as either 1 or 0 when used in a mathematical equation. e.g. 0.5 + TRUE = 1.5 while 0.5 + FALSE = 0.5.
Test to see if the minuend is less than the subtrahend and if it is, add 1 to it using the result of the test itself.
=(C11+(C11<B11)-B11)*24
      
Finally, it should be mentioned that while you can subtract a larger time from a smaller time to receive a negative decimal value, the negative value cannot be interpreted as time since Excel does not recognize negative time. If you were not multiplying by 24 to retrieve the hours as integers and simply subtracting B11 from C11 the cell would be filled with hashmarks (e.g. ############) to show the error. e.g. 08:00 - 10:00 = (as time) #######.

Round time to nearest 15 minutes

I'm trying to round my overtimes in Excel and I found 2 formulas:
=FLOOR(A1,"00:15")
as well as
=ROUNDDOWN((A1)*(24*60/15),0)/(24*60/15)
and they both failed when there was a time which does NOT need rounding down.
It is all good when I want to round down e.g. 01:29 to 01:15 or 00:48 to 00:45, but when I have e.g. 01:30 it rounds it down to 01:15, when obviously I need to leave it as it is:/
A1 is the example cell when my time is stored.
for 01:30, this formula:
=FLOOR(A1,"00:15")
returns 01:30 for me.
I am on Excel 2010
Like others have said, =FLOOR(A1,"00:15") should work, but if your version of Excel doesn't do the right thing for some reason, this should work:
=TIME(HOUR(A1),FLOOR(MINUTE(A1)/15,1)*15,0)
=FLOOR(D4*96;1)/96 works fine.
Why 96 ? Because for time units, 1 = 1 day, so 1 hour = 1/24.
You multiply by 24 then by 4 (for quarters), then floor, then divide by 4 to get rounded quarters.

Resources