Jim O.
Jim O.

Reputation: 1111

match multiple columns within the same row

Table 1. I have a table that looks like this:

X       Y       Z
1       a       p
2       a       p
6       b       p
7       c       p
9       c       p

Table 2. I have a different table that looks like this:

        Col1    Col2    Col3    Col4   
Row1            p       p       p
Row2            a       b       c
Row3    1               
Row4    2               
Row5    3           
Row6    4           
Row7    5           
Row8    6                   
Row9    7                       
Row10   8           
Row11   9                     

I want to mark "TRUE" when rows of table 1 match with values of its column in Table 1. As a result for example:

        Col1    Col2    Col3    Col4
Row1            p       p       p
Row2            a       b       c
Row3    1       TRUE        
Row4    2       TRUE        
Row5    3           
Row6    4           
Row7    5           
Row8    6               TRUE        
Row9    7                       TRUE    
Row10   8           
Row11   9                       TRUE

Here is what I have tried so far. This is the formula for Col2 Row3:

=IFERROR(IF(AND(AND(MATCH(Col1Row3,X:X,0), MATCH(Col2Row1,Z:Z,0)), MATCH(Col2Row2,Y:Y,0)), "TRUE", ""),"")

I think it's not working because I am not containing the matches within the same row. How can I achieve my result?

Also, I do not want to specify a specific row in the formula because I have thousands of rows in Table 1, and Table 2 has to select values among those thousands of rows.

Upvotes: 0

Views: 46

Answers (1)

Scott Craner
Scott Craner

Reputation: 152525

Use COUNTIFS

=IF(COUNTIFS($F:$F,$A3,$G:$G,B$2,$H:$H,B$1),TRUE,"")

enter image description here

Upvotes: 1

Related Questions