4
Spectrum that I am using complete with 10,000 data points
I am a chemistry student of sorts and I frequently have instances where I need to find multiple peak heights (as seen in the attached picture). It seems like there would be a way to find the y-value of each of these peaks at a given x and print those values out as data labels on the graph and in various cells, but I can't figure it out. I believe that using:
=IF(AND(C4>C3,C4>C5),"Local maxima","")
along with:
Sub CustomLabels()
Dim i, myCount, pt
ActiveSheet.ChartObjects("myChart").Activate
myCount = ActiveChart.SeriesCollection(1).Points.Count
For i = 1 To myCount
ActiveChart.SeriesCollection(1).Points(i).ApplyDataLabels
ActiveChart.SeriesCollection(1).Points(i).DataLabel.Text = Range("D" & i + 1).Value
Next i
End Sub
Will yield something that looks like this:
What I would like to do:
Get those labels that say "max" to say the actual values, preferably the x and y values, but just the y works too.
Making it so the max values appeared in a new column would be really great. To clarify, I have 10000 points and should end up with 40 peaks. I would like to get a hypothetical column D to populate with those 40 max values.
Finally, since there are 10000 values, I need to find a way to filter out the values that are below my desired peak heights (in the first picture).
How can I achieve the above?
I think I figured it out. I couldn't have done it without you. I just used: =IF(AND(C4>0,C5<0,B4>0.318,A4>2500,A4<3200),A4&","&B4,"") – Nicholas Brandon – 2016-04-06T02:47:22.403
If that helped, please mark the answer as described in the Tour
– teylyn – 2016-04-06T03:55:48.090