I'm working often with spectral data of various gases, and the bulk of the data analysis is assigning the peaks with maximum signal (y-axis) to frequency (x-axis). Often we have several thousand data points, and it can be quite difficult to manually find peaks. I've tried getting around this in Excel with clever IF/AND statements, but the major obstacle is signal noise: I simply cannot devise a clever Excel statement to help me pick peaks.

For example, using an =IF(AND(greater signal than adjacent points),"max","") statement gives tons of extraneous hits where the noise causes a slight fluctuation in the data. Similarly, creating a column of slopes and doing an =IF(slope goes from + to -),"max","") statement also gives bad data.

The most elegant solution I have is to pick an arbitrary value # that most of my peaks are above and use an =IF(AND(slope goes from + to -,B>#),"max","") statement. That seems to work for stronger peaks (maybe 70% of the peaks on a good day), but I still have to go in and manually look at the weaker peaks (and often when doing these spectra many energetic transitions that need labeling are statistically unlikely-->low signal). I'm wondering if anyone here has a better solution able to detect local maxima not resulting from noise with a better success rate.

  • $\begingroup$ What signal-to-noise ratios are you trying to successfully observe peaks within? $\endgroup$
    – long
    Apr 20, 2015 at 23:32
  • $\begingroup$ The SNR seems pretty high, I can very easily see the peaks and just look through those regions to find local maxima. Are you thinking about using the noise standard deviation to weed out bad hits? $\endgroup$
    – Stagg C.
    Apr 20, 2015 at 23:36
  • $\begingroup$ Yep. Also, if you only have positive peaks and have a good horizontal baseline centered around zero, you could calculate noise from the negative noise component, and double it. This will give you low SNR peaks. Presumably you data set has a large number of points. $\endgroup$
    – long
    Apr 20, 2015 at 23:56
  • $\begingroup$ You're right, it's a large data set. That actually worked pretty well for part of the data, but unfortunately our IR isn't very good, so the higher frequency region sees the baseline deviating downwards to below zero. $\endgroup$
    – Stagg C.
    Apr 21, 2015 at 0:17
  • 2
    $\begingroup$ I would smooth your data with a rolling average and the repeat your if(and(...)), adding as one of the constraints that the absolute signal value be greater than some threshold. If that doesn't work, it may be time to move beyond Excel. The python/scipy code scipy.signal.find_peaks_cwt() would probably be a one-liner for you. $\endgroup$
    – Curt F.
    Apr 21, 2015 at 0:38

1 Answer 1


One thing you can do before searching for peaks is to smooth the data with a 9 point (or 15 point) moving average. I'm not sure how the ends are handled, but the average of 9 points replaces the data point so noise fluctuations are reduced.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.