<https://forum.ozgrid.com/forum/index.php?thread/1218100-trigger-based-on-maxima-and-minima/&pageNo=2>
<http://schema.org/articleBody>
"Hi,\n\nI found some VBA code for finding local maximas and minimas. Compared to some cell formulas it works best, but I really don't care if these calulations are cell formulas or VBA.\n\nSeveral cell formulas that I tested for tested for finding local maximas and minimas, missed some points. The code included in this post seems to work best. That's why I am posting to the VBA Forum.\n\n(Code, 19 lines)\n\n\n(Code, 302 lines)\n\n\nAlso included are data collected in an experimental environment. This is what I tested the included code with. Column A is time data, column B is the experimental data.\n\nColumn C is local maxima- column D is the local minima.\n\nHere's what is supposed to happen: following a local maxima, as the data value is falling, column E would indicate True when column B reaches 0.8x  (80%) of the last local maxima. It will stay True until the next local minima occurs. At this point, column E would indicate False when column B reaches 1.2x (120%) of the last local minima.\n\nSince the data is cyclic, this will repeat through the dataset.\n\nCould anyone in the Forum help with code or cell formulas to get the output that I need?\n\nThanks,\n\n-Art"
<https://forum.ozgrid.com/forum/index.php?thread/1218100-trigger-based-on-maxima-and-minima/&postID=1218470>