Forum Discussion

Immapotato's avatar
Immapotato
Copper Contributor
Apr 03, 2023

Counting value combos based on matching values in other columns.

I am not sure this is even possible, I am trying to find a way to count possible test combinations:

 

The table below is an example, I need to be able to Count how many rows have matching Name, Date, and Time with Test A and B, A and C, and A, B, and C.

 

NameTestDateTime
AAA1/17/202322:39
AAB1/17/202322:39
ABA1/17/20237:51
ACA1/20/202321:14
ACB1/20/202321:14
ACC1/20/202321:14
ADB1/8/202319:01
AEA1/9/20239:19
AEC1/9/202323:06

The Result would look like this:

CombosTotal
A+B1
A+C0
A+B+C1

 

OR translate this table to a format where the values of the Test column would be returned in the same row when Name, Date, and Time match 

AAAB 1/17/202322:39
ACABC1/20/202321:14

 

Is there anyway to do this? I have thousands of entries imported into Excel and am hoping a formula can do this.

4 Replies

  • NikolinoDE's avatar
    NikolinoDE
    Gold Contributor

    Immapotato 

    Yes, it is possible to count possible test combinations. 

    You can use a helper column and a formula based on the COUNTIFS function.

    Here’s how you can do it:

    1. Add a helper column to your table.
    2. In the first cell of the helper column, enter the following formula and copy it down to all cells in the helper column:
    3. =A2&B2&C2

    This will concatenate the values in columns A, B, and C for each row.

    1. In another cell, enter the following formula:
    2. =COUNTIFS($D$2:$D$10,"*"&A13&"*",$D$2:$D$10,"*"&B13&"*")

    Replace A13 and B13 with the values you want to count combinations for.

    1. Copy the formula down to all cells in the table.

    This will give you a count of how many rows have matching Name, Date, and Time with Test A and B, A and C, and A, B, and C.

     

     

     

    I hope that helps!

    NikolinoDE

    I know I don't know anything (Socrates)

    • Immapotato's avatar
      Immapotato
      Copper Contributor

      NikolinoDE 

       

      Thank you for your help! I am having some trouble figuring out parts of the formula you gave me (everything I know about excel is self taught using forums like these so I am probably just not using it correctly).

       

      For =A2&B2&C2

             Am I using this in that A=the Name column, B=the Date column, and C=the Time column?

             - If yes, then this part I got to work 🙂 though I am not sure how it works with the next         formula

       

      For =COUNTIFS($D$2:$D$10,"*"&A13&"*",$D$2:$D$10,"*"&B13&"*")

             Is D the column the tests are in or is it the helper column? 

             - This is the part I am not getting to work as it returns "0" for everything.

      If it the test column where does the helper column come in and if it is the helper column where does the test column come in?

       

      Any clarification would be greatly appreciated!!!

Resources