+ Reply to Thread
Results 1 to 5 of 5

Find crossing points based on a given condition

  1. #1
    Registered User
    Join Date
    09-01-2014
    Location
    Portugal
    MS-Off Ver
    2010
    Posts
    6

    Find crossing points based on a given condition

    Hi fellows,

    I need to solve this problem:
    I have got two sets of independent data (700 and 300 registers each).
    Register data type is
    column A----- X1 coordinate column E----- X2 coordinate
    column B------Y1 coordinate column F----- Y2 coordinate
    column C------Z1 coordinate column G----- Z2 coordinate

    Basically I want to compare each X, Y values from dataset one with each X, Y values from dataset two,
    and for that I must use euclidean distance criteria

    if sqrt((X1 - X2)^2 + (Y1-Y2)^2)< 0.1 (for example)

    If the conditon is met, I need to write the avarages to new columns
    (X1+X2)/2------column I
    (Y1+Y2)/2 -----column J

    and calculate abs(Z1-Z2) -----column K

    This will return crossing points and the high difference between sets

    THANK YOU

  2. #2
    Valued Forum Contributor mahju's Avatar
    Join Date
    11-27-2010
    Location
    Pakistan, Faisalabad
    MS-Off Ver
    Excel 2010 plus
    Posts
    730

    Re: Find crossing points based on a given condition

    Hi
    Try this

    For X coordinates

    Please Login or Register  to view this content.
    For Y coordinates

    Please Login or Register  to view this content.
    Mark the thread as solved if you are satisfied with the answer.


    In your first post under the thread tools.

    Mahju

  3. #3
    Registered User
    Join Date
    09-01-2014
    Location
    Portugal
    MS-Off Ver
    2010
    Posts
    6

    Re: Find crossing points based on a given condition

    Hi Mahju,

    the code must test the condition for
    each dataset A registers with all dataset B registers

    dataset A dataset B
    col a col b col c col e col f col g

    line 1 AX1 AY1 AZ1 BX1 BY1 BZ1
    line 2 AX2 AY2 AZ2 BX2 BY2 BZ2

    ... ... ...

    line n AXn AYn AZn BXn BYn BZn

    So, starting on the first register on dataset A

    if sqrt((AX1-BX1)^2 + (AY1-BY1)^2)<0.1 then write

    col i col j col k

    (AX1+BX1)/2 (AY1+BY1)/2 abs(AZ1-BZ1)

    in the condition isn't met go on...

    if sqrt((AX1-BX2)^2 + (AY1-BY2)^2)<0.1
    if sqrt((AX1-BX3)^2 + (AY1-BY3)^2)<0.1
    ...

    if sqrt((AX1-BXn)^2 + (AY1-BYn)^2)<0.1

    ...and start all over again to

    if sqrt((AX2-BX1)^2 + (AY2-BY1)^2)<0.1
    if sqrt((AX2-BX2)^2 + (AY2-BY2)^2)<0.1
    ...

    if sqrt((AX2-BXn)^2 + (AY2-BYn)^2)<0.1

    Thank You very much for you time!!

  4. #4
    Valued Forum Contributor mahju's Avatar
    Join Date
    11-27-2010
    Location
    Pakistan, Faisalabad
    MS-Off Ver
    Excel 2010 plus
    Posts
    730

    Re: Find crossing points based on a given condition

    Hi
    I think VBA is required to do this type of analysis. Also it may take much time to complete, if it is done with a formula.
    I am not much good in VBA so I hand it over to another expert.
    I advise you to use access for this type of question.

    If you can upload a sample file then a more expert person may dive you the answer

    I have done it for your first comparison see attached file

    Any way Thanks for your time

    Copy down the formulae in cols I,J & K
    Thanks & Regards
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    09-01-2014
    Location
    Portugal
    MS-Off Ver
    2010
    Posts
    6

    Re: Find crossing points based on a given condition

    Mahju,

    your example fits perfectly to my problem and it's so very usefull for smaller datasets. I'm handling more than 2000 registers per dataset!!
    I tried on Access but I had to round my real numbers to integers, and then it was able to match some registers.
    So, you're completely right: it must be solved with VBA code, and I already dive on it to address some new questions.

    Thank you so much Mahju

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Formula to find out MAX and MIN based on 3rd cell condition
    By helpbitte in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-12-2013, 05:31 AM
  2. Crossing points in two columns of data
    By worswick25 in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 10-19-2011, 07:17 AM
  3. Find and replace based on condition macro
    By contra76 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-25-2010, 10:58 PM
  4. vba help pls - find min based on a condition and return val of an offset cell
    By Impakt in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-16-2005, 08:06 PM
  5. Find Min based on condition & return val of offset cell
    By impakt in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-16-2005, 09:12 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1