Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
Hi guys,
Basically i have a set of data plotted on an x-y scatter plot where at a single point the two curves cross over each other and meet at a single point, i.e. 'x and y values are both the same where they cross. Im trying to determine this operating point by generating lookup tables for both each curve., for example in the x axis i need to match the same x value for one curve '1st lookup table row' with the same x value of the other curve '2nd lookup table row'. But the corresponding y values also need to be matching or relatively close to find the right point. Any ideas how this can be achieved, i was thinking of using a VLOOKUP and INDEX functions but it's much more complicated than that. Any advice would be great, |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This might help. Suppose the source of the two lines is Range("B2:C25") on Sheet1.
Sub FindCrossover() Dim dDiff(2 To 25) As Double Dim dMin As Double Dim iCt As Integer Dim iX As Integer For iCt = 2 To 25 dDiff(iCt) = Sheet1.Cells(iCt, "B") - Sheet1.Cells(iCt, "C") Next iCt For iCt = 3 To 25 If (dDiff(iCt) = 0 And dDiff(iCt - 1) < 0) _ Or (dDiff(iCt) <= 0 And dDiff(iCt - 1) 0) Then 'found crossover iX = iCt dMin = Abs(dDiff(iCt)) If Abs(dDiff(iCt - 1)) < Abs(dDiff(iCt)) Then dMin = dDiff(iCt - 1) iX = iCt - 1 End If Debug.Print iX, Sheet1.Cells(iX, "B"), Sheet1.Cells(iX, "C") Exit For End If Next iCt End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA: Matching cells across columns, and returning equal values | Excel Discussion (Misc queries) | |||
matching similar values | Excel Programming | |||
Summing Similar Columns of Data | Excel Programming | |||
Returning last columns with no values in (but possibly w. formulas | Excel Programming | |||
returning values from columns to another sheet, based on conditions | Excel Programming |