complicated formula

phillipcook

Board Regular
Joined
Jun 25, 2015
Messages
87
Hi Guys

I am trying to work out a call out charge

with this charge, if the total call out hours worked on a day are less than 4.0 hours, (for example a total of 5 different call outs equal 03:40 hours OT worked) than the charge rate becomes 4 hours.

In my calculation I have 10 possible lines worth of data from $R$2:$R$11.

The formula that I currently have works which is as follows:

=IF(R2="","",IF(SUM($R$2:$R$11)>=0.16666667,R2,0.16666667))

However I have found a flaw in this calculation.

for example lets say I have 5 rows of OT (between $R$2:$R$11) that combined have a total of 03:40 call outs. the above formula would actually calculate the formula cells from S2:S11 to 4.0 hours each which means the total call out hours would be 20.0 hours for the day and not 4.0

What I need to do is the following:

> If cell R2 is blank, then the formula cell remains blank
> if R2 has data then calculate the sum of $R$2:$R$11, if it is above 04:00 then S2 cell equals R2
> If the calculation of $R$2:$R$11 is less than 04:00 then the formula needs to do the following:

*EXAMPLE OF CALL OUT TIMES IN R2:R11*
row 1 00:30
row 2 01:00
row 3 00:25
row 4 00:15
row 5 01:30

This calculation would be in S2

> Combined the total of hours (example 03:40)
> Convert the value from time to percentage (example 03:40 would become 3.67)
> Calculate 1% of the total time in R2:R11 (example 1% of 3.67 becomes 0.036667)
> Convert R2 time to percentage and devide by the 1% value of the entire summed time (example 0.5/ 0.036667=13.63636)
> Convert 04:00 time to percentage and calculate 1% of 4:00 hours (example 04:00 becomes 4.00/ 100 = 0.02)
> Multiply R2 percentage by the 1% of 4 hours (example 0.02*13.63636=0.02272727)

The formula cell formatting would need to be [HH]:mm for this to work.

I just can't figure out how to convert the above mathematics to a formula

All help would be greatly appreciated!!

I hope I explained it well enough?

Thanks in advance.
 
Last edited:

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Re: complicated formula - need assistance!!!

Do you realize that all the 1% constants you use cancel each other out algebraically? Also, with the way that Excel stores times, as a fraction of a day, you don't need to perform all the conversions (time to percentage)?

Given that, try:

=IF(R2="","",IF(SUM(R2:R11)>4/24,R2,R2/SUM(R2:R11)/(24/4)))

The 4 in red is the 4:00 you refer to, and you could easily either simplify the formula by dividing, or put 4 in a cell in case you ever want to change that number.

In any case, I'm not sure what all your steps are supposed to accomplish, but I believe I've accounted for them all, and this formula returns the same result as your example. Hope it helps.
 
Upvote 0

Forum statistics

Threads
1,214,929
Messages
6,122,317
Members
449,081
Latest member
tanurai

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top