+ Reply to Thread
Results 1 to 7 of 7

Formula to count matches between multiple columns on different sheets w/ multiple criteria

  1. #1
    Registered User
    Join Date
    12-10-2018
    Location
    LOS ANGELES
    MS-Off Ver
    OFFICE PRO 2021
    Posts
    56

    Formula to count matches between multiple columns on different sheets w/ multiple criteria

    I normally will spend hours if necessary to find the formula to a problem. Until now I have eventually figured every one of them out except this time, i am stumped.
    I am putting together a spreadsheet for players in a contest and trying to work out a formula for consensus selections between the players. I have almost got the results I wanted using both SUMPRODUCT and COUNTIFS but with flaws in both.
    All the sheets are identical, column A is dates, column B is a selection, column O is a selection, column AA is the sum of winners in that row (result is always 1 if there is a selection and there can only be 1), column AB is same as AA just that its the losers.

    I am trying to figure out a formula that will compare a range in column A on Sheet1 to a range in column A on Sheet2 for matches if column A and B OR column A and O are the same and if the match was a win (by matching column AA) or loss (by matching column AB) showing as a W-L format. The following is the best I could come up with but it only compares column A and B (doesnt check A and O) and if column A and B are the same on row 16 on sheet1 and the same exists on sheet2 on row 15

    =SUMPRODUCT(--(A9:A32=Sheet2!A9:A32)*(Sheet1!B9:B32=Sheet2!B9:B32)*(Sheet1!AA9:AA32=1))&"-"&SUMPRODUCT(--(A9:A32=Sheet2!A9:A32)*(Sheet1!B9:B32=Sheet2!B9:B32)*(Sheet1!AB9:AB32=1))

    Sorry if it was confusing, I included a copy of the spreadsheet for clarity.
    Attached Files Attached Files

  2. #2
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Formula to count matches between multiple columns on different sheets w/ multiple crit

    Please try at AE10

    =SUMPRODUCT(COUNTIFS(A9:A32,Sheet2!A9:A32,B9:B32,Sheet2!B9:B32),AA9:AA32)&"-"&SUMPRODUCT(COUNTIFS(A9:A32,Sheet2!A9:A32,B9:B32,Sheet2!B9:B32),AB9:AB32)

    I'm not sure on how you calculate the result for
    column A and B OR column A and O are the same
    Please provide more sample and the expected result.

    Maybe this for Win??
    =MAX(SUMPRODUCT(COUNTIFS(A9:A32,Sheet2!A9:A32,B9:B32,Sheet2!B9:B32),AA9:AA32),SUMPRODUCT(COUNTIFS(A9:A32,Sheet2!A9:A32,O9:O32,Sheet2!O9:O32),AA9:AA32))

  3. #3
    Registered User
    Join Date
    12-10-2018
    Location
    LOS ANGELES
    MS-Off Ver
    OFFICE PRO 2021
    Posts
    56

    Re: Formula to count matches between multiple columns on different sheets w/ multiple crit

    Quote Originally Posted by Bo_Ry View Post
    Please try at AE10

    =SUMPRODUCT(COUNTIFS(A9:A32,Sheet2!A9:A32,B9:B32,Sheet2!B9:B32),AA9:AA32)&"-"&SUMPRODUCT(COUNTIFS(A9:A32,Sheet2!A9:A32,B9:B32,Sheet2!B9:B32),AB9:AB32)
    That formula doesnt work either, the result is not being correctly determined.

    I can eliminate the need for column O to be checked. What this spreadsheet needs to do is to check each row in a range and count matches in the same range on a different sheet that will likely not be in the same rows.
    So the date in column A AND the corresponding 3 letter code in column B AND a "1" in column AA must be an identical match to the same in another sheet (possibly a different row) for it to be counted.
    So if the date of 1/2/19 matches in sheet1 and sheet2 anywhere in the range A9:A32, then column B and AA must be a match as well. The date in sheet1 may be located in A19 but in sheet2 it is located in A23. As long as the rest of the columns in that row are a match then it should be counted as a match.

    I have included another example with a new sheet added giving an example. Thanks for the help.
    Attached Files Attached Files

  4. #4
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Formula to count matches between multiple columns on different sheets w/ multiple crit

    Please try again

    =SUMPRODUCT(COUNTIFS(Sheet2!A9:A32,A9:A32,Sheet2!B9:B32,B9:B32),AA9:AA32)&"-"&SUMPRODUCT(COUNTIFS(Sheet2!A9:A32,A9:A32,Sheet2!B9:B32,B9:B32),AB9:AB32)

  5. #5
    Registered User
    Join Date
    12-10-2018
    Location
    LOS ANGELES
    MS-Off Ver
    OFFICE PRO 2021
    Posts
    56

    Re: Formula to count matches between multiple columns on different sheets w/ multiple crit

    Thats it except for 1 thing...

    Look at row 10 in NEWSheet1, there is a red "1" in E10 which is a match in Sheet2. If you delete the "1" in E10 and place a "1" in D10 then the count becomes 4-0 from 3-1 when it should be 3-0 since a match was just eliminated. It should not be counted as a match since one was a winner and one was a loser. That is what I meant by they also have to match the value in the AA or AB column as well. It should be the third criteria that they are equal.

  6. #6
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Formula to count matches between multiple columns on different sheets w/ multiple crit

    Please try again

    =SUMPRODUCT(COUNTIFS(Sheet2!A9:A32,A9:A32,Sheet2!B9:B32,B9:B32,Sheet2!AA9:AA32,AA9:AA32),AA9:AA32)&"-"&SUMPRODUCT(COUNTIFS(Sheet2!A9:A32,A9:A32,Sheet2!B9:B32,B9:B32,Sheet2!AB9:AB32,AB9:AB32),AB9:AB32)

    AA9 can change to
    =IFERROR(1/(1/SUMIFS($D9:$Z9,$D$7:$Z$7,AA$8)),"")
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    12-10-2018
    Location
    LOS ANGELES
    MS-Off Ver
    OFFICE PRO 2021
    Posts
    56

    Re: Formula to count matches between multiple columns on different sheets w/ multiple crit

    Wow, thats it! My brain hurts a little less when I look at that formula now.

    As for the replacement formula for AA9, it took me a second to get it but it also helped me to understand both the formulas a little better and how I may be able to use them.

    Thank you very much!

+ 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. [SOLVED] SUMPRODUCT of multiple columns with multiple criteria over multiple sheets
    By BellyGas in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-16-2015, 08:27 AM
  2. [SOLVED] Need formula to count multiple criteria in 2 columns
    By tancho321 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-22-2013, 04:53 PM
  3. Replies: 0
    Last Post: 01-11-2013, 02:39 AM
  4. Replies: 8
    Last Post: 07-13-2012, 06:00 AM
  5. Replies: 2
    Last Post: 09-16-2011, 07:45 AM
  6. Count - multiple criteria, multiple sheets, and date range.
    By threecliffs in forum Excel General
    Replies: 6
    Last Post: 06-14-2011, 01:36 PM
  7. trying to count unique occurences w/in data that matches multiple criteria
    By broro183 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-07-2006, 08:11 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