+ Reply to Thread
Results 1 to 5 of 5

Finding the Correlation Between Two Arrays, but only if a third column contains a specific

  1. #1
    Registered User
    Join Date
    04-03-2013
    Location
    New Jersey
    MS-Off Ver
    Excel 2007
    Posts
    7

    Finding the Correlation Between Two Arrays, but only if a third column contains a specific

    Hello All.

    Thanks in advance for any help. I did search for an answer to my question, but did not find an answer.

    I'm trying to find the correlation between two arrays. In the example I have created (and attached) I'd like to find the correlation between "hits" (in column B) and the weather (which "sunny" or "cloudy" in column C, but which I have converted to binary, 0 or 1, in column D).

    So, I am looking for the correlation between column B and column D. But...

    I don't want it for the whole array. In column A, we have the "hitters" names: Amy, Beth, and Carrie. I want to know: what is the correlation between hits (col B) and weather (col d) when the hitter is Amy (col a)? When the hitter is Beth? Carrie?

    I appreciate any help with this
    Attached Files Attached Files

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Finding the Correlation Between Two Arrays, but only if a third column contains a spec

    Use this array formula

    =CORREL(IF($A$2:$A$19="Amy",$B$2:$B$19),IF($C$2:$C$19="Sunny",$D$2:$D$19))

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    Change for variables

    Note: For all 3 variables your correlation would result in #Div/0!. Change the values and you'll see the formula works
    Last edited by Ace_XL; 07-18-2013 at 12:46 PM.
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Registered User
    Join Date
    04-03-2013
    Location
    New Jersey
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Finding the Correlation Between Two Arrays, but only if a third column contains a spec

    Thanks for getting back to me so quickly on this. I'm going to play with this then report back

  4. #4
    Registered User
    Join Date
    04-03-2013
    Location
    New Jersey
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Finding the Correlation Between Two Arrays, but only if a third column contains a spec

    Hmm, I'm working with this, and I get a div/0 when O ctrl/shft/enter.

    even after I change the values of the data. why?

  5. #5
    Registered User
    Join Date
    04-03-2013
    Location
    New Jersey
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Finding the Correlation Between Two Arrays, but only if a third column contains a spec

    After changing some of the values of weather (the binary one) to 0, I found I started getting some meaningful correlations.

    Does this mean that when you have a correlation of 1, excel will sometimes express that as "Div/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. VBA - Using variables to populate arrays for Correlation
    By jmatwilson in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-08-2012, 09:03 PM
  2. Replies: 2
    Last Post: 05-13-2012, 04:00 PM
  3. VBA to loop correlation between two arrays in large data set
    By amedhussaini in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-28-2009, 08:20 PM
  4. Replies: 3
    Last Post: 08-05-2009, 03:45 PM
  5. Finding correlation
    By WolfMV in forum Excel General
    Replies: 0
    Last Post: 11-16-2007, 02:04 PM

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