I have lots of data and many files that I want to run this macro on. The data shows voltage and the overall shape is a sin wave, but its not completly smooth. I think by taking the absolute min and max, it might result in something that is not the true peak or valley i want. I can look at the data and very easily tell where the points are, but since they are not so smooth, i don't know if this will make it difficult for excel to determine. What I would like it to do after finding these points is to take the corresponding y values (which in this case y is time) and have the macro tell me the time between the two points by writing it in a cell.
Yes, if the data contain either noise or high-frequency components that you want to ignore (as you describe), then it is not just a straightforward matter of finding local max and min values. The algorithm would either have to do some local smoothing, filtering, or even curve fitting. If the signal is totally continuous with no transient part, I would recommend Fourier analysis which would give you the frequencies of the various harmonics, and from what you describe I believe you want the period (1/frequency) of the lowest harmonic (the fundamental frequency). Excel has a Fourier analysis tool (Excel mistakenly groups it in its Statistical tool set) that you could use for this.
But if the function is transient or has a significant transient component you should use smoothing, such as a sliding fit on a number of points that is small compared to the period of the fundamental frequency, looking for inflections in the fit function that are within the range of the sliding fit.