Welcome to the forum.

You can certainly add levels by adding conditions to the SUMPRODUCT like this:

| A | B | C | D |
---|

1 | | | | |

2 | | | | |

3 | | | | |

4 | | | "Peaks" | Range |

5 | | | | |

6 | 190 | | 155 | 1 |

7 | 386 | | | |

8 | 675 | | 8 | 2 |

9 | 398 | | | |

10 | 776 | | 1 | 3 |

11 | 702 | | | |

12 | 38 | | | |

<tbody>

</tbody>

**Sheet1**

**Worksheet Formulas**
Cell | Formula |
---|
C6 | =SUMPRODUCT(--(A6:A1004>A5:A1003),--(A6:A1004< A7:A1005)) |
---|
C8 | =SUMPRODUCT(--(A6:A1004>A5:A1003),--(A5:A1003>A4:A1002),--(A6:A1004< A7:A1005),--(A7:A1005< A8:A1006)) |
---|
C10 | =SUMPRODUCT(--(A6:A1004>A5:A1003),--(A5:A1003>A4:A1002),--(A4:A1002>A3:A1001),--(A6:A1004< A7:A1005),--(A7:A1005< A8:A1006),--(A8:A1006< A9:A1007)) |
---|
<tbody>
</tbody> |

<tbody>

</tbody>

I tried coming up with a formula where you just enter the range you want (1-5) in a cell and the formula will adapt, but that's probably more trouble than it's worth. It's not too hard to add another pair of conditions.

What's more problematic is that I rather doubt that this will give you what you want. If there's any slight variation in the temperatures in a given range, it won't be counted. In the random sample I created, the number of peaks dropped rapidly. Your not-so-random range will probably behave differently, but I suspect you'll still miss out on some peaks.

What you'd probably want to do is some type of slope analysis. For example, take cells A1:A10, calculate the slope using SLOPE, and see if it is rising (+) or falling (-). Then repeat with A2:A11. At some point, the slope will switch from rising to falling, and that's where you want to count a peak.

That's probably more that I can help with, since it would require a lot of analysis: what's the ideal range size to use, how to handle outliers, etc. Also probably VBA vs. a formula.