Results 1 to 4 of 4

Cooccurrence matrix construction with countifs

Threaded View

clw496 Cooccurrence matrix... 05-19-2016, 05:32 AM
JohnTopley Re: Cooccurrence matrix... 05-19-2016, 05:53 AM
clw496 Re: Cooccurrence matrix... 05-19-2016, 08:10 AM
JohnTopley Re: Cooccurrence matrix... 05-19-2016, 08:36 AM
  1. #1
    Registered User
    Join Date
    11-02-2013
    Location
    Davis
    MS-Off Ver
    Excel 2003, Excel 2013
    Posts
    7

    Cooccurrence matrix construction with countifs

    Hello,

    I have a set of data where 15 products represented by 3-digit values were sorted into different groups. I need to populate a cooccurrence matrix, where if two products are in the same group, their intersection in the matrix is assigned a "1"; if not, the intersection can either be left blank or gets a zero. I have come up with a way to do this by typing in each group as a separate column and then using a number of =COUNTIF statements to populate the matrix, but I feel like there must be a more elegant way to do this (maybe with =COUNTIFS and =AND/=OR functions?), but I haven't had any success so far.

    I've attached an example spreadsheet with my current solution if anyone would like to take a look. This is the current formula I'm working with from cell B2: =IF(COUNTIF($A$21:$A$36,$A2)+COUNTIF($A$21:$A$36,B$1)=2,1,IF(COUNTIF($B$21:$B$36,$A2)+COUNTIF($B$21:$B$36,B$1)=2,1,IF(COUNTIF($C$21:$C$36,$A2)+COUNTIF($C$21:$C$36,B$1)=2,1,IF(COUNTIF($D$21:$D$36,$A2)+COUNTIF($D$21:$D$36,B$1)=2,1,""))))

    My main problem is that there can be up to 2-14 groups (columns) with 1-14 codes in each column, and I feel like repeating the = COUNTIF formula 14 times must be excessive... Any ideas?
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 11-05-2014, 03:41 AM
  2. Eigenvector of matrix for nxn matrix of variable size
    By rocketscientist165 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-14-2014, 10:51 AM
  3. Replies: 2
    Last Post: 02-11-2014, 05:05 AM
  4. Using a transition matrix as input to a cummulative matrix
    By Walter12 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-26-2012, 04:19 AM
  5. Replies: 0
    Last Post: 12-16-2011, 09:01 AM
  6. [SOLVED] Array Construction
    By M Moore in forum Excel General
    Replies: 1
    Last Post: 07-23-2006, 06:35 PM
  7. formula construction w/ vba
    By Gixxer_J_97 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-07-2005, 10:05 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