Calculating the longest duration over which a value was maintained in an Excel column

zacuk

Board Regular
Joined
Dec 22, 2016
Messages
60
Hi, In my Excel file, column 'V' has data from a process and the value peaks to around 6.0 at multiple times, during the process. The time corresponding to each data point is captured in a separate column 'C'. I would consider all values between 5.5 and 6.0 as the peak. Some time the peak value is maintained for 2 hours before dropping down to <5.5. At other times, it can be up for 6 hours.


I am interested in finding out the 'Maximum duration' over which the peak value (5.5-6.0) was maintained.


I am not much used to VBA, so a formula would be great. Otherwise, I'd appreciate if you can write the VBA code which I paste in the macro box and run it, please.


Thanks
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
PS: Forgot to mention that I have managed to write a formula but it works with the highest number only. So, e.g., it would give the duration for which the value stayed it 6.0 and ignores the peak at 5.9 even if it lasted for longer than when the value was 6.0.

The formula I have made is based on Index/match using offset function to set the lookup range start at the max value.

I want the formula to return the output based on the max duration whether it is for the peak at 6.0 or 5.9. Thanks
 
Upvote 0

Forum statistics

Threads
1,214,892
Messages
6,122,112
Members
449,066
Latest member
Andyg666

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