+ Reply to Thread
Results 1 to 2 of 2

Replacing a COUNTIF column with a single cell calculation (with complex criteria)

  1. #1
    Registered User
    Join Date
    12-04-2014
    Location
    Colorado, USA
    MS-Off Ver
    2010, 2013
    Posts
    7

    Replacing a COUNTIF column with a single cell calculation (with complex criteria)

    Hello all,

    I have a list of x,y coordinates (for an event) in two columns and need to determine how many of the points that are defined by these coordinates are near (within 50 units) another point (target area). Doing this for a single target area was relatively simple, as I just made another column that calculated the distance using the Pythagorean theorem and put a countif statement at the bottom that looked for distances over 50.

    However, I have an 11 x 11 array of target areas and doing 121 additional columns is going to be impractical. I am looking to replace the additional columns with a calculation from a single cell. I attempted to use a convoluted COUNTIF statement that included the Pythagorean theorem in the criteria but it is not working and I don’t know if it will work (from what I’ve read on COUNTIF, it probably won’t).

    In the attached data file you will find seven columns and a table of the target values I am trying to calculate. Columns A & B are the x,y coordinates that I have generated, columns C & D reflect the center of the distribution (I will eventually have different distributions with central coordinates). Columns E-G are my basic calculation columns that I am attempting to turn into single cell formulas, with column E corresponding to V12, Column F to L 12, and Column G to V14.
    J1:AF22 is the table I am attempting to populate, with the values L2:AF1 being how far the target area is from the center in X, and K2:K22 being how far the target area from the center in y

    My current attempt at calculation is the following formula (from L2, which does not work but might help you see my logic:
    =COUNTIF($A$2:$B$101,SQRT((($A$2:$A$101-(500+$L4)))^2+(($B$2:$B$101-(400+K$2))^2))<"50")

    Thanks!
    Attached Files Attached Files
    Last edited by MaverickBlack; 01-28-2015 at 05:11 PM. Reason: Typos

  2. #2
    Registered User
    Join Date
    12-04-2014
    Location
    Colorado, USA
    MS-Off Ver
    2010, 2013
    Posts
    7

    Re: Replacing a COUNTIF column with a single cell calculation (with complex criteria)

    I will leave this up in case anyone else needs it, but I figured it out.

    I ended up using a SUM function, which was quite simple, but overlooked because I got stuck trying to figure out COUNTIF.

    =SUM(IF(SQRT((($A$2:$A$101-(500+L$1)))^2+(($B$2:$B$101-(400+$K2))^2))<50,1,0))

+ 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. Return dates that match a single criteria (a countif criteria)
    By nickmax1 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-07-2014, 12:43 PM
  2. [SOLVED] Countif Help with Multi criteria in a single cell
    By Dear_Maria in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-26-2013, 12:23 PM
  3. Replies: 2
    Last Post: 09-04-2012, 07:04 AM
  4. Countif with single column but criteria
    By asdvender in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-20-2008, 11:33 PM
  5. Countif Function, complex criteria
    By Tomski in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-09-2006, 11:45 AM

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