Min and Max in sequence

Daniel_CW

New Member
Joined
Nov 9, 2019
Messages
2
Good day,

I have two columns of data, 1st is time and the second are values, The time column is from 4.00am to 4.00am the next day increasing by 1hour intervals, the values increase to a max and then decline in a series of highs and lows. I want to calculate the change in value meaning the highest value - lowest value divided by the corresponding change in time. i dont want a simple max and min since the values are increasing and decreasing in a series of low to highs. i hope you can help, below is just an example of how the data set looks.

timevalue
4am2
5am3
6am5
7am7
8am6
9am4
10am2
11am3
12pm5

<tbody>
</tbody>
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Welcome to the MrExcel board!

What about you finish the one-day sample and also provide the expected result(s) for that sample with some explanation of how you got the result manually?
 
Last edited:
Upvote 0
Hi,

Could this work?

Date-timevalueIs highest in cycleIs lowest in cyclesteps highest-to-lowestHighest-to-lowest differenceHighest-to-lowest hoursChange rate per hour
2019-11-09 04:00 AM2FALSEFALSE----
2019-11-09 05:00 AM3FALSEFALSE----
2019-11-09 06:00 AM5FALSEFALSE----
2019-11-09 07:00 AM7TRUEFALSE4531.67
2019-11-09 08:00 AM6FALSEFALSE----
2019-11-09 09:00 AM4FALSEFALSE----
2019-11-09 10:00 AM2FALSETRUE----
2019-11-09 11:00 AM3FALSEFALSE----
2019-11-09 12:00 PM5TRUEFALSE2313.00
2019-11-09 01:00 PM2FALSETRUE----
2019-11-09 02:00 PM3FALSEFALSE----
2019-11-09 03:00 PM4FALSEFALSE----
2019-11-09 04:00 PM7FALSEFALSE----
2019-11-09 05:00 PM9FALSEFALSE----
2019-11-09 06:00 PM10FALSEFALSE----
2019-11-09 07:00 PM40TRUEFALSE63757.40
2019-11-09 08:00 PM19FALSEFALSE----
2019-11-09 09:00 PM15FALSEFALSE----
2019-11-09 10:00 PM10FALSEFALSE----
2019-11-09 11:00 PM5FALSEFALSE----
2019-11-10 12:00 AM3FALSETRUE----
2019-11-10 01:00 AM7TRUEFALSE4531.67
2019-11-10 02:00 AM6FALSEFALSE----
2019-11-10 03:00 AM4FALSEFALSE----
2019-11-10 04:00 AM2FALSETRUE----
2019-11-10 05:00 AM3FALSEFALSE----
2019-11-10 06:00 AM4FALSEFALSE----


<colgroup><col><col span="7"></colgroup><tbody>
</tbody>
 
Upvote 0
Like this? Tried to post a bigger example but seems it was moderated away:


Date-timevalueIs highest in cycleIs lowest in cyclesteps highest-to-lowestHighest-to-lowest differenceHighest-to-lowest hoursChange rate per hour
2019-11-09 07:00 AM7TRUEFALSE4531.67
2019-11-09 08:00 AM6FALSEFALSE----
2019-11-09 09:00 AM4FALSEFALSE----
2019-11-09 10:00 AM2FALSETRUE----
2019-11-09 11:00 AM3FALSEFALSE----
2019-11-09 12:00 PM5TRUEFALSE2313.00
2019-11-09 01:00 PM2FALSETRUE----

<colgroup><col><col span="7"></colgroup><tbody>
</tbody>
 
Upvote 0
timevalue
4am2
5am3
6am6
7am7
8am8
9am7
10am6
11am5
12pm3
1pm2
2pm4
3pm5
4pm6
5pm9
6pm7
7pm5
8pm4
9pm3
10pm2
11pm4
12am5
1am6
2am8
3am7
4am5

<tbody>
</tbody>

4am - 2
8am - 8

(8-2)/(8am-4am)
6/4hrs
=1.5
then

1pm - 2
5pm - 9

(9-2)/(5pm-1pm)
7/4hrs
=1.75

Welcome to the MrExcel board!

What about you finish the one-day sample and also provide the expected result(s) for that sample with some explanation of how you got the result manually?
 
Upvote 0
Thanks for the additional sample.
See if these would suffice. You could hide column C once populated with its formulas if you want.

00 HTML Conversions.xlsm
ABCD
1timevalue
24:00 AM21 
35:00 AM3  
46:00 AM6  
57:00 AM7  
68:00 AM8x1.5
79:00 AM7  
810:00 AM6  
911:00 AM5  
1012:00 PM3  
111:00 PM21 
122:00 PM4  
133:00 PM5  
144:00 PM6  
155:00 PM9x1.75
166:00 PM7  
177:00 PM5  
188:00 PM4  
199:00 PM3  
2010:00 PM21 
2111:00 PM4  
2212:00 AM5  
231:00 AM6  
242:00 AM8x-0.3
253:00 AM7  
264:00 AM5  
Min Max Sequence
Cell Formulas
RangeFormula
C2:C26C2=IF(AND(B2>B3,B2>B1),"x",IF(AND(B2<B3,B2<B1),1,""))
D2:D26D2=IF(C2="x",(B2-LOOKUP(2,C$1:C1,B$1:B1))/((A2-LOOKUP(2,C$1:C1,A$1:A1))*24),"")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,707
Members
448,981
Latest member
recon11bucks

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