Google-sheets – INDEX & MATCH / VLOOKUP counting number of found matches instead of showing one of them

google sheetsvlookup

I have two sheets in Google Sheets. In one I have two columns with values I need to find in two columns of the second one and return number of matches for each row in the first one.

=Iferror(INDEX ( Leads!$C$2:C$1000, ( MATCH ( $A2 & $B2,Leads!$A$2:$A$1000 & Leads!$B$2:$B$100, 0 ))),0)

I've been using this function and then assigning it 1 or 0 values with IF function, but it works only for a range without more than one match.

How to do it when there are more matches?

Best Answer

You have not mentioned what format your data is in, but please try:

=COUNTA(QUERY(Leads!A:B,"SELECT A WHERE A = '"&Sheet1!A1&"' and B = '"&Sheet1!B1&"' "))

copied down to suit.

COUNTA QUERY