+ Reply to Thread
Results 1 to 4 of 4

Using Pythagoras theorem to count results

  1. #1
    Registered User
    Join Date
    05-19-2010
    Location
    Brighton
    MS-Off Ver
    Excel 2003
    Posts
    1

    Unhappy Using Pythagoras theorem to count results

    Hello all,
    I have a spreadsheet of co-ordinates (Eastings & Northings). Columns A & B contain the co-ordinates of school premises. Columns E & F contain the co-ordinates of anti-social behaviour incidents. In column C I'd like to show a count of anti-social behaviour incidents occuring with 100m of the school (Easting & Northings are in metres which is handy)

    Easting Northing Results Easting Northing
    502871 107008 ------------- 518902 116729
    585461 136574 ------------- 531108 108205
    487650 135334 -------------

    In my actual data I have about 464 anti-social behaviour incidents and 697 schools

    I've worked out how to calculate the distance between school and incident using a pythagoras formula like this...

    =SQRT((ABS(A2-D2))^2+(ABS(B2-E2))^2)

    ...but that isn't really what I need. What I really need is a count are incidents where the answer to this formula is >100m

    Please help? I've tried everything I can think of.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: A question of Pythagoras

    Do you mean something like:

    =SUMPRODUCT(--(SQRT((ABS(A2:A10-C2:D10))^2+(ABS(B2:B10-E2:E10))^2)>100))

    adjust ranges to suit.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: Using Pythagoras theorem to count results

    see sample attached.
    I think in the following quote, you meant <100.

    Please Login or Register  to view this content.
    Anyway, your formula in Column C is fine. I have added a formula in C2 at the top of the column to give you a count of all results that are less than 100 meters.

    modytrane
    Attached Files Attached Files

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Using Pythagoras theorem to count results

    The ABS is redundant. Just

    =SQRT((A2-D2)^2 + (B2-E2)^2)

    or

    =SQRT(SUMSQ(A2-D2, B2-E2))
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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