Hello,
I'm trying to find the peak and valley values of a sinusoidal function. I have a column with ID numbers (column A) where each ID has its own list of y-values. Currently I'm using IF(MAX) and IF(MIN) functions where I find the max of column D (y axis) within 40 rows and returns the value if true and a blank cell if false. With these functions I have to examine the values for each ID and change the range on random cells because there are small waves within the large waves and I only want the peaks and valleys of the large waves.

Is there a way to find the maximum within each group of positive numbers and the minimum within each group of negative numbers for each ID number? Thanks in advance.