Search code examples
excelexcel-formulaexcel-2007

CountIF in different Sheet and equal values


enter image description here

enter image description here

Scenario:

I Want to Count the Values of Sheet 2 (Lower Image) Column C into Sheet 1 Column C, IF the values of Sheet 2 Columns A and B is equal to Sheet 1 Columns A and B.

this is without using excel-vba,

thanks,


Solution

  • In a Comment @Dirk Reichel has offered:

     =COUNTIFS(Sheet2!A:A,A2,Sheet2!B:B,B2)  
    

    which it seems may have been acceptable to the OP. This makes (IMO the very reasonable) assumption that there will always be a value in the FarmerID field in Sheet 2. However OP has not specified that there will be and for the sake of those with the same issue that may have blanks I suggest a third condition to exclude those from the count:

    =COUNTIFS('Sheet 2'!A:A,A2,'Sheet 2'!B:B,B2,'Sheet 2'!C:C,"<>"&"")