Columns F:H make three separate calculations. Column J puts all three into one monster formula.

F2: `=SUMPRODUCT((D2< $A$2:$A$3)*(E2>$A$2:$A$3)*($A$2:$A$3-D2))*24*60`

This says if Actual Start is less than Scheduled Start and Actual End is greater than Scheduled Start, return the difference between Scheduled Start and Actual Start. This is billable minutes before the scheduled time.

G2: `=SUMPRODUCT((E2>$B$2:$B$3)*(D2< $B$2:$B$3)*(E2-$B$2:$B$3))*24*60`

This says if Actual End is greater than Scheduled End and Actual Start is less than Scheduled End, return the difference between Actual End and Scheduled End. This is billable minutes after the scheduled time.

H2: `=(SUMPRODUCT(((D2< $A$2:$A$3)*(E2<$A$2:$A$3))+((D2>$B$2:$B$3)*(E2>$B$2:$B$3)))-(COUNT($A$2:$A$3)-1))*(E2-D2)*24*60`

This says if Actual Start and End are before Scheduled Start OR Actual Start and End are after Scheduled End, count them up. If that count is the same number as schedules, then there is no overlap with any scheduled time, so add up the total minutes.

Everything is multiplied by 24 hours per day and 60 minutes per hour to convert to minutes.

The monster formula is:

J2: `=(SUMPRODUCT((D2< $A$2:$A$3)*(E2>$A$2:$A$3)*($A$2:$A$3-D2))+SUMPRODUCT((E2>$B$2:$B$3)*(D2< $B$2:$B$3)*(E2-$B$2:$B$3))+(SUMPRODUCT(((D2<$A$2:$A$3)*(E2<$A$2:$A$3))+((D2>$B$2:$B$3)*(E2>$B$2:$B$3)))-(COUNT($A$2:$A$3)-1))*(E2-D2))*24*60`

For example, a person schedules the following times to use the computer in the month of December:

12/1/2019 23:00 to 12/2/2019 08:00

12/12/2019 11:00 to 12/12/2019 12:00

And they actually use the computer during the following times:

12/1/2019 23:45 to 12/2/2019 08:06 – they should be billed for 6 minutes of use

12/3/2019 09:00 to 12/3/2019 09:30 – They should be billed for 30 minutes of use

Hope this clears things up!

]]>This doesn’t work when you click on refresh data. It works only when the sheets are already set. When I run this code, it shows ‘ No overlaps found’. But, when I refresh the whole sheet, I see the same error. Please help me out. This is really frustrating.

]]>Table57 ‘Stats’!$A$14:$Y$20

How do I know which table is number 57?! Sorry, I am a bit of a novice!

]]>Once you have your parameters, you can invert the formula to get a CharUnit value for a given Width in points:

ChartUnit = If(WidthInPts <= MAX, WidthInPts/MAX, (WidthInPts – B)/A)

Note Excel only keeps 2 digits for CharUnit values.

]]>Ratio(CharUnit) = Min(9.00, 5.25 + ( 3.75 / CharUnit)).

It means the ratio remains the same for CharUnit = zero to 1, and then evolves following an f(x) = 1/x fashion to converge towards ratio = 5.25 for large values of CharUnit. For CharUnit values over 50, you are less than 2% away from 5.25.

This explains why for some values you only needed 2 loops instead of 3 to be close to the final ratio value.

The generic formula is: Ratio(CharUnit) = Min(MAX, A + ( B / CharUnit)).

You can calculate the parameters as follows:

– Measure the ratio for CharUnit=1. This is the value for MAX.

– Measure the ratio for a very large CharUnit value (>200?). This value is A.

– Then B = MAX – A.

Note it looks like Excel rounds the values of these parameters to the nearest 0.25. So to calculate A, I would always round down to the closest .25.

For example, with Calibri 11, Ratio(200.00) = 1053.75/200=5.27 -> rounded down to 5.25.

Then Ratio(1.00) = 9.00 = MAX, so B = 9.00 – 5.25 = 3.75.

Once you have your parameters, you can reverse the formula to get a CharUnit value for a given Width in points: do WidthInPts = ChartUnit * Min(MAX, A + ( B / CharUnit)).

Took me a whole afternoon to break the mysteries of the Range.Width getter!