Forum Discussion

Rachel1994's avatar
Rachel1994
Copper Contributor
May 11, 2022

How to search on one column and then count distinct entries in another column (Excel)

I am trying to compare sales data from two tables. The first table shows product info (Location, product code etc.), and the second table shows all transaction data (Location, product code, customer info for each transaction).

I want to look at each product+location in the first table, then find all instances of it in the second table, and count the number of distinct customers 

 

Example data:

 

Product Data Table

LocationProduct CodeDescription
Location AProduct 1Car
Location BProduct 1Car
Location AProduct 2Bike
Location BProduct 2Bike

 

Order Data Table

LocationProduct CodeOrder number

Customer

Location AProduct 101234Customer X
Location A Product 101235Customer X
Location A Product 101236Customer Y
Location AProduct 201237Customer X
Location BProduct 101238Customer X

 

In this example,  I want to know the number of distinct customers who ordered Product 1 from Location A, which is 2.

 

I would appreciate any help I can get!

Resources