Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 1
Default Returning two similar values from two different columns

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Returning two similar values from two different columns

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA: Matching cells across columns, and returning equal values Babymech Excel Discussion (Misc queries) 0 January 26th 09 04:41 PM
matching similar values Tyrone Excel Programming 5 August 23rd 07 12:38 PM
Summing Similar Columns of Data noname Excel Programming 1 May 3rd 07 07:06 PM
Returning last columns with no values in (but possibly w. formulas Kragelund Excel Programming 4 February 3rd 07 08:15 AM
returning values from columns to another sheet, based on conditions zangief Excel Programming 1 September 26th 05 08:13 PM


All times are GMT +1. The time now is 06:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"