Calculating Cost Based On 15 Minute Increments In Excel - excel

This one's confusing, I have a user who has requested an excel sheet that allows them to enter a time in minutes into cell A1 that will calculate a value to charge another company in cell C1. However the charging criteria is as follows:
£355.68 for the first hour,
£88.92 for every 15 minutes after that
AND if during one of those 15 minute increments the time goes over 7 minutes, it gets rounded up to a full 15 minutes or down if it's under 7 minutes. I have literally no idea where to even begin on this one.

Assuming the value in A1 is simply a number of minutes and the charge is £355.68 for any time between 1 and 60 minutes, I think the following should work:
=355.68+IF(A1>60,88.92*(FLOOR((A1-60)/15,1)+IF(A1-60-15*FLOOR((A1-60)/15,1)>7,1,0)),0)
Explanation:
We start with the base cost of £355.68. The use of FLOOR((A1-60)/15,1) gives us the number of completed 15 minute intervals we have after the first hour. We initially multiply this by £88.92, and then we check how many minutes are left over once we take into account the first hour and any completed 15 minute period - A1-60-15*FLOOR((A1-60)/15,1). If this is greater than 7, we add an extra £88.92 for the "partial completion".

To round to the "closest" 15 minute interval, where the "split" occurs at 7 minutes, and you are entering your time as "Excel Minutes" (e.g. the difference between a starting and ending time in minutes, or entered as, for example 00:42, just add a bit less than 30 seconds to the time (e.g. 29 seconds), and then round to the nearest 15 minutes.
e.g: (one of the below)
=MROUND(A1+TIME(0,0,29),TIME(0,15,0))
=MROUND(A1+29/86400,15/1440)
or, using ROUND
=ROUND((A1+TIME(0,0,29))/TIME(0,15,0),0)*TIME(0,15,0)
=ROUND((A1+29/86400)/15*1440,0)*15/1440
You should be able to work out the rest. If you can't, post what you have tried and where you are running into problems.

Related

Excel formula or VBA Identifying gaps in overlapping dates and times

I am attempting to find any gaps calculated in minutes between a start and stop date/time range. Essentially time when there are no appointments in the schedule, this is a 24hr service and I am looking for "dead" time when there isn't a customer in the office.
Currently I was attempting to use the =SUMPRODUCT((A2<B$2:B$19)*(B2>A$2:A$19))>1 to find overlaps and the issue I am running into is if there are any overlap in start or stop it disqualifies and does not truly identify the space between appointments just if that appointment is double booked at all.
Here is a new version of the Gap and Island solution to this problem, using Excel 365 functionality:
=LET(start,A2:A19,
end,B2:B19,
row,SEQUENCE(ROWS(start)),
maxSoFar,SCAN(0,row,LAMBDA(a,c,IF(c=1,INDEX(start,1),IF(INDEX(end,c-1)>a,INDEX(end,c-1),a)))),
SUM(IF(start>maxSoFar,start-maxSoFar,0)))
The algorithm is very simple:
- Sort data by start time if necessary, then for each pair of times:
- Record the latest finish time so far (maxSoFar) (not including the present appointment)
- If the start time (start) is greater than maxSoFar, add start-maxSoFar to the total.
The first time interval is a special case - initialise maxSoFar to the first start time.
It can be seen that there are only two gaps in the appointments, from 4:15 to 7:31 (3 hours 16 minutes) and from 11:48 to 14:17 (3 hours 29 minutes) totalling 5 hours 45 minutes.
Why didn't I just use Max to make the code shorter? I don't know:
=LET(start,A2:A19,
end,B2:B19,
row,SEQUENCE(ROWS(start)),
maxSoFar,SCAN(0,row,LAMBDA(a,c,IF(c=1,INDEX(start,1),MAX(INDEX(end,c-1),a)))),
SUM(IF(start>maxSoFar,start-maxSoFar,0)))
To find the gaps between appointments in a schedule, you can try using the following formula:
=SUM(B2:B19)-SUMPRODUCT((A2<B$2:B$19)*(B2>A$2:A$19))
You can then convert the duration to minutes by multiplying the result by 1440 (the number of minutes in a day).
=1440*(SUM(B2:B19)-SUMPRODUCT((A2<B$2:B$19)*(B2>A$2:A$19)))

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)

how to Calculate payment hours+minutes in excel

let’s say I am getting paid 20$ per hour by by my employer and he wants to calculate hours+minutes (not only hours).
if I just want to calculate hours I will use =x*20 in excel
but I want to calculate hours and minutes, let’s say I worked for 1.30 hours, I can use same formula and write 1.30*20= but this doesn't work
the rate in cents is something like 33 cents, how can I just type something like 1.30 (one hour and 30 min) and get the result calculated according to 20$ per hour.
I don’t want to write in minutes because then each time I have to calculate manually then write and it will be messy.
I want to just type hours and minutes in one filed and get the result based on 20$ per hour on the other field. thanks
I use this formula: =ROUND(HOUR(X) + MINUTE(X)/60;2)*20 where X is the cell with the time
I'd use something like: =(TRUNC(x)+MOD(x,1)/0.6)*20
Trunc(x) = hours
Mod(x,1) = fractional part (0.3)
Convert the Mod value to Minutes by dividing by 0.60
Where x = the hour.minute value. (e.g., 1.3 = 1 hour 30 minutes)
This is probably a really long way to do it.
Take the time, as 1.3 for 1 hour 30 mins, remove the minutes and convert to a number you can multiply by, add the hours back and multiply by the hourly rate.
`=(((Time-INT(Time)) * 100/60) + INT(Time))*20

Excel units of time conversion

I need to change a value of time from days:hours:minutes, into either hours with a decimal or minutes. My data comes up as 001:05:46 for example. I am having trouble with the leading zeros confusing excel. Any help would be great!
Assuming that your value to parse is formatted in DDD:HH:MM like 001:05:46... There are a lot of ways to do this but here's a simple one. To convert into hours we need to take the days times 24 hours per day, add the hours, and add the minutes times 1 hour per 60 minutes:
=LEFT(A1,3)*24+MID(A1,5,2)+RIGHT(A1,2)/60
To get this value in terms of minutes we multiply by 60 minutes per hour. A possible modification of the original formula to reach this point would be:
=LEFT(A1,3)*24*60+MID(A1,5,2)*60+RIGHT(A1,2)

Subtract time from duration only if above specified amount

Working on a timesheet (duplicate of sheet 1 in link).
The current function to handle the calculations is:
B4=6:00am
C4=6:00pm
X4=0:30:00
=IF(OR(B4="",C4=""),"",IFERROR(C4-B4-X4,""))
The thing is we don't subtract 30 minutes for lunch unless an employee works longer than 6 hours and 15 minutes.
How can I fix my function to only subtract 30 mins for lunch if the total time for that day is over 6 hours and 15 mins?
Provided there is no risk of times spanning midnight, please try:
=IF(OR(B4="",C4=""),"",IF(C4-B4>6.25/24,C4-B4-X4,C4-B4))

Resources