How to automatically calculate the "max earning per hour" (or the Max slope of a curve)

zacuk

Board Regular
Joined
Dec 22, 2016
Messages
60
Hi,

How can we make Excel automatically calculate the maximum slope in the following type of data, please? For example, the max earning per hour (or the Max slope) in the following data is $20/hour. Note: the earnings per hour change every day.

Time
(h)
Total Earning
($)
00
110
220
330
440
560
680
7100
8120
9140
10160

<tbody>
</tbody>

Thanks
 
Last edited:

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Maybe this? (Assuming that your data is from A1 to B12 with headers in row 1).

=MAX(B3:B12-B2:B11) Ctrl Shift Enter
 
Upvote 0
Code:
{=MAX(IFERROR((B2:B12-B1:B11)/(A2:A12-A1:A11),0))}

Use ctrl+shift+enter to enter as array formula

try something like that (not tested)... you just calculate the slope for every value, the formula relies on the list to be sorted and since i calcualte the difference in hours you dont need sequential hours
 
Last edited:
Upvote 0
Time
(h)Total Earninghelper
($)
00
11010
22010this is just current minus previous
33010as you go up in 1 hour intervals
44010
56020just take max(E5:E14)
68020
710020
812020
914020can the hours go up in 0.5 hour intervals ?
1016020

<colgroup><col><col><col span="9"></colgroup><tbody>
</tbody>
 
Upvote 0
Hi Cerfani, this looks pretty good. I have modified the array formula to fit into my Excel template. I have also made it calculate 3-point average:

{=MAX(IFERROR((BM14:BM20-BM12:BM18)/(C14:C20-C12:C18),0))}

At the moment, we have specified which rows to look at. As the numbers change from day to day and the 'peak' or 'max' rate may be outside this range (Rows 12 to 20), is it possible to improve the formula to start calculating from any row as soon as the numbers have exceeded 10 times the initial value, within Rows 10 to 50.

So, for example, in the following case, I would like the formula to start calculating from Row#6 (i.e., from 5 h onward):

Time
(h)
Total Earning
($)
010
110
220
350
480
5105
6120
and so on

<tbody>
</tbody>

Thanks
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,575
Messages
6,125,619
Members
449,238
Latest member
wcbyers

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