+ Reply to Thread
Results 1 to 2 of 2

Can't COUNTIF an array VLOOKUP without intermediate cells

  1. #1
    Registered User
    Join Date
    04-13-2009
    Location
    Ontario
    MS-Off Ver
    Excel 2003/7
    Posts
    1

    Can't COUNTIF an array VLOOKUP without intermediate cells

    The attached workbook is simplified from my actual workbook.

    On the Wins tab you will see the manual table of number of 1sts, 2nds, 3rds for each player, and next to it the calculated table. (The manual table is wrong, hence the need to move to a calculated table.)

    The Wins tab uses an array VLOOKUP(col,table,{c1,c2,c3...}) to get the finished-in-what-place data for each player from the first worksheet and then dumps that into an array of cells. Then the calculated table does a COUNTIF() on that array of cells for each of 1st, 2nd, 3rd.

    I thought it would be possible to have a simpler solution without the array of cells, conceptually:
    COUNTIF(VLOOKUP(col,table,{c1,c2,c3...})
    for each of 1st, etc, except that isn't a valid formula, likely because the array VLOOKUP() output isn't what COUNTIF() is expecting as input. Is there a way to get this to work? (I don't like the intermediate array of cells.)

    Or, is there a better way to create the calculated table?

    I've researched array formulas via google and have learned enough to know that often a VLOOKUP can be done equally well with something else.

    I'm new enough to array formulas to not know what something else looks like.

    I recognise that the current structure means one VLOOKUP and three COUNTIFs, and my desired solution without the array of cells means three VLOOKUPs.

    ...Stu
    Attached Files Attached Files

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Can't COUNTIF an array VLOOKUP without intermediate cells

    Stu,

    You don't need to use a CSE Array to populate your results table - you could use INDEX / MATCH, eg:

    M2: =IF(ISNA(MATCH($B2,Points!$B$5:$B$35,0)),"",INDEX(Points!$H$5:$CD$35,MATCH($B2,Points!$B$5:$B$35,0),1+3*(COLUMNS($M2:M2)-1)))
    applied across matrix

    If you wanted to negate the need for the table altogether then your options are relatively limited given your layout... ie SUMPRODUCT

    First I would use Column C to identify player row, eg:

    Wins!C2: =MATCH($B2,Points!$B$5:$B$35,0)

    Then you can use this row in an INDEX call within the Sumproduct itself, eg:

    Wins!D2: =IF(ISNA($C2),"",SUMPRODUCT(--(Points!$H$4:$CD$4="Place"),--(INDEX(Points!$H$5:$CD$35,$C2,0)=COLUMNS($D2:D2))))

    applied across matrix

    What I would say is that used in large numbers Sumproducts (like CSE arrays) will impact performance... if your data ranges are huge this will become more profound... try to keep range sizes to a minimum.

+ 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