Combining COUNT IF AND VLOOK UP EXCEL

Kiwi picture Kiwi · Mar 22, 2013 · Viewed 174.7k times · Source

I have multiple spreadsheets in a workbook and I would like the following in basic English talk:

IF worksheet1(cell)A3, appears in 'worksheet2' column B - count how many times it appears in column b 'worksheet 2'

So in other words - Lets say A3 = BOB smith - in work sheet 1 and appears 4 times in worksheet 2 - I want the formula to count the fact that A3 'Bob smith' is in worksheet 2 4 times, and come back and tell me 4.

I have attempted to do separate calculations - with use of Vlookups - then in another cell to count/do if statement for example

=COUNTIF(VLOOKUP(A9,'To retire'!J:J,9,1))
=IF(J228=O233, 'worksheet2'!F440,0)
=VLOOKUP(A3,'worksheet2'!A:A,1,1)

Help would be very much appreciated, I am very stuck - I am unsure if I am looking into this too deeply or not enough! Thank you in advance

Answer

mechanical_meat picture mechanical_meat · Mar 22, 2013

This is trivial when you use SUMPRODUCT. Por ejemplo:

=SUMPRODUCT((worksheet2!A:A=A3)*1)

You could put the above formula in cell B3, where A3 is the name you want to find in worksheet2.