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.

[TABLE="width: 200"]
<tbody>[TR]
[TD]time[/TD]
[TD]value[/TD]
[/TR]
[TR]
[TD]4am[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]5am[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]6am[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]7am[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD]8am[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]9am[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]10am[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]11am[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]12pm[/TD]
[TD]5[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
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?

[TABLE="width: 805"]
<colgroup><col><col span="7"></colgroup><tbody>[TR]
[TD]Date-time[/TD]
[TD]value[/TD]
[TD]Is highest in cycle[/TD]
[TD]Is lowest in cycle[/TD]
[TD]steps highest-to-lowest[/TD]
[TD]Highest-to-lowest difference[/TD]
[TD]Highest-to-lowest hours[/TD]
[TD]Change rate per hour[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 04:00 AM[/TD]
[TD="align: right"]2[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 05:00 AM[/TD]
[TD="align: right"]3[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 06:00 AM[/TD]
[TD="align: right"]5[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 07:00 AM[/TD]
[TD="align: right"]7[/TD]
[TD="align: center"]TRUE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]4[/TD]
[TD]5[/TD]
[TD]3[/TD]
[TD]1.67[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 08:00 AM[/TD]
[TD="align: right"]6[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 09:00 AM[/TD]
[TD="align: right"]4[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 10:00 AM[/TD]
[TD="align: right"]2[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]TRUE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 11:00 AM[/TD]
[TD="align: right"]3[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 12:00 PM[/TD]
[TD="align: right"]5[/TD]
[TD="align: center"]TRUE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]1[/TD]
[TD]3.00[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 01:00 PM[/TD]
[TD="align: right"]2[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]TRUE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 02:00 PM[/TD]
[TD="align: right"]3[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 03:00 PM[/TD]
[TD="align: right"]4[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 04:00 PM[/TD]
[TD="align: right"]7[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 05:00 PM[/TD]
[TD="align: right"]9[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 06:00 PM[/TD]
[TD="align: right"]10[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 07:00 PM[/TD]
[TD="align: right"]40[/TD]
[TD="align: center"]TRUE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]6[/TD]
[TD]37[/TD]
[TD]5[/TD]
[TD]7.40[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 08:00 PM[/TD]
[TD="align: right"]19[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 09:00 PM[/TD]
[TD="align: right"]15[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 10:00 PM[/TD]
[TD="align: right"]10[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 11:00 PM[/TD]
[TD="align: right"]5[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-10 12:00 AM[/TD]
[TD="align: right"]3[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]TRUE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-10 01:00 AM[/TD]
[TD="align: right"]7[/TD]
[TD="align: center"]TRUE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]4[/TD]
[TD]5[/TD]
[TD]3[/TD]
[TD]1.67[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-10 02:00 AM[/TD]
[TD="align: right"]6[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-10 03:00 AM[/TD]
[TD="align: right"]4[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-10 04:00 AM[/TD]
[TD="align: right"]2[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]TRUE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-10 05:00 AM[/TD]
[TD="align: right"]3[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-10 06:00 AM[/TD]
[TD="align: right"]4[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-

[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Like this? Tried to post a bigger example but seems it was moderated away:


[TABLE="width: 805"]
<colgroup><col><col span="7"></colgroup><tbody>[TR]
[TD]Date-time[/TD]
[TD]value[/TD]
[TD]Is highest in cycle[/TD]
[TD]Is lowest in cycle[/TD]
[TD]steps highest-to-lowest[/TD]
[TD]Highest-to-lowest difference[/TD]
[TD]Highest-to-lowest hours[/TD]
[TD]Change rate per hour[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 07:00 AM[/TD]
[TD="align: right"]7[/TD]
[TD="align: center"]TRUE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]4[/TD]
[TD]5[/TD]
[TD]3[/TD]
[TD]1.67[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 08:00 AM[/TD]
[TD="align: right"]6[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 09:00 AM[/TD]
[TD="align: right"]4[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 10:00 AM[/TD]
[TD="align: right"]2[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]TRUE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 11:00 AM[/TD]
[TD="align: right"]3[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 12:00 PM[/TD]
[TD="align: right"]5[/TD]
[TD="align: center"]TRUE[/TD]
[TD="align: center"]FALSE[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]1[/TD]
[TD]3.00[/TD]
[/TR]
[TR]
[TD="align: right"]2019-11-09 01:00 PM[/TD]
[TD="align: right"]2[/TD]
[TD="align: center"]FALSE[/TD]
[TD="align: center"]TRUE[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[TD]-[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
[TABLE="width: 200"]
<tbody>[TR]
[TD]time[/TD]
[TD]value[/TD]
[/TR]
[TR]
[TD]4am[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]5am[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]6am[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]7am[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD]8am[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]9am[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD]10am[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]11am[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]12pm[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]1pm[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]2pm[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]3pm[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]4pm[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]5pm[/TD]
[TD]9[/TD]
[/TR]
[TR]
[TD]6pm[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD]7pm[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]8pm[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]9pm[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]10pm[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]11pm[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]12am[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]1am[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]2am[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]3am[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD]4am[/TD]
[TD]5[/TD]
[/TR]
</tbody>[/TABLE]

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,224,740
Messages
6,180,678
Members
452,993
Latest member
FDARYABEE

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