Finding a peak value in an array within an array

Burkie

New Member
Joined
Jun 4, 2024
Messages
7
Office Version
  1. 365
Platform
  1. Windows
Hi. Need help please.
  • I have a set of 100,000 CO2 readings, taken every 15 minutes from classrooms in a school.
  • I am interested in the reading once it goes over 650 ( identified by the green in the attached extract )
  • I need to identify the PEAK value WHILE it is WITHIN the 650 zone.
  • There are a number of sub-peaks within the zone ( 5 in the extract I attached )
  • So, I need a formula that knows its within the 650 zone and identifies the peak of the peaks and then resets when it leaves the 650 zone !

THANK YOU.

Burkie.
 

Attachments

  • Finding the PEAK within an Array.PNG
    Finding the PEAK within an Array.PNG
    82.9 KB · Views: 22
Thanks Guys. Really appreciate the help.
I'm attaching a sample of the bigger file. Each point where the value go over 650 and enter the zone, is different i.e, sometimes it might only be in the zone for
5 points, other times it could be 20. In fact, sometimes the ENTRY data point is actually the peak value as well ! So looking back and forward a fixed number of cells cannot be used.
Essentially, the solution needs to mark the entry point and start measuring each value until it gets to the exit point, then it needs to mark the highest value it encountered.
Maybe a VBA is the only way to do it. I've never used VBAs before ( just youtubing it now 😀 ).
PS: I not allowed download the XL2BB tool.
 
Upvote 0

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Waiting for the sample data.
A graph of what you have and what you need would be helpful too. Explaining in detail all the cases you mentioned and explain exactly what you expect. It is not very clear what you need exactly.
 
Upvote 0
Maybe this will do?

I uploaded a working file here: FindingPeaks.zip

You can test differente (randomly generated) sample data by pressing F9.

Let me know if this works for you. And we can clean the file up and make it a one cell formula.
 
Upvote 0
Here is the one cell formula:

FindingPeaks2.zip

As before you can test with generated sample data by pressing F9.

The formula used in B2:

FindingPeaks2.xlsx
AB
1DataResult
2738 
3766766
4670
5734
6602
7658
8659
9728728
10664
11642
12577
13516
14638
15765
16826
17693
18727
19805
20715
21742
22806
23779
24820
25879879
26780
27791
28687
29736
30758
31700
32776
33676
34765
35786
36722
37747
38719
39771
40692
41597
42580
43542
44457
45584
46511
47573
48577
49519
50438
51482
52521
53521
54617
55711
56776
57833
58885885
59811
60832
61833
62757
63663
64645
65558
66431
67429
68432
69555
70652
71719
72772
73845845
74756
75660
76596
77457
78545
79457
80503
81425
82547
83695
84684
85664
86802
87844
88856856
One cell solution
Cell Formulas
RangeFormula
B2:B88B2=LET( d,A2:A88, above, d>650, prevAbove, DROP(VSTACK(0,above),-1), entryPoint, above>prevAbove, id, DROP(REDUCE({0},entryPoint,LAMBDA(x,y,VSTACK(x,MAX(x)+y*1))),1), dataId, HSTACK(d,id), BYROW(dataId, LAMBDA(x, IFERROR(IF(CHOOSECOLS(x,1)= MAX(FILTER(d, (id = CHOOSECOLS(x, 2))*(above))), CHOOSECOLS(x,1),""),"") )) )
A2A2=550+RANDBETWEEN(0,200)
A3A3=A2+RANDBETWEEN(-100-(AVERAGE(A1:A2)>650)*50,100+(AVERAGE(A1:A2)<650)*50)
A4A4=A3+RANDBETWEEN(-100-(AVERAGE(A1:A3)>650)*50,100+(AVERAGE(A1:A3)<650)*50)
A5A5=A4+RANDBETWEEN(-100-(AVERAGE(A1:A4)>650)*50,100+(AVERAGE(A1:A4)<650)*50)
A6:A88A6=A5+RANDBETWEEN(-100-(AVERAGE(A1:A5)>650)*50,100+(AVERAGE(A1:A5)<650)*50)
Dynamic array formulas.


Let me know if this works for you.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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