Reputation: 1
I need a formula to count the number of unique IDS when the value in a column matches the value in another column.
Column A - Year | Column B - Number of Unique Firms | Column D - Firm ID Number | Column E - Year 2
For B2 I want a formula that says, check column D for the number of unique firms that had a transaction in the year (Year 2 column) that matches the value in A2. Basically give a count of all the firms that had a transaction in 2013.
I am trying to generate the values that are highlighted in the above picture in yellow.
In the actual data, Columns D and E are in a separate spreadsheet and there are over 150 thousand rows.
Upvotes: 0
Views: 281
Reputation: 3802
Formula solution without helper column
In B2
, enter formula :
=SUMPRODUCT((E$2:E$15=A2)/(COUNTIFS(D$2:D$15,D$2:D$15,E$2:E$15,E$2:E$15)))
Upvotes: 1
Reputation: 3168
I don't know what your limitations are, e.g. VBA, Helper Columns, etc. But here's a solution using helper columns.
You need 3 formulas:
You need to setup your helper columns as shown here:
Place formula 1 in G4 after adjusting the references, which I'd highly recommend you to change to dynamic range names. There is no need to do anything further with this formula!
Next, place formula 2 in H3 and then fill down and across, again using dynamic range names.
Lastly place formula 3 in B3 and fill down. Once again using dynamic range names.
Upvotes: 0