Count unique values with condition

LaPimpa Posted messages 7 Status Membre -  
LaPimpa Posted messages 7 Status Membre -
Hello community,

The question has been raised several times, but none of the solutions found work in my file, and your help would be greatly appreciated!

I am looking for a formula without VBA to count the number of unique companies by industry.

Example:

In column A: company names (with duplicates)
In column B: the company’s industry

- the company KIKI appears 4 times (column A), in the category "Food Industry" (column B)
- the company BABA appears 2 times (column A), in the category "Food Industry" (column B)
I therefore have 2 unique companies in the "Food Industry" category.

To calculate this, I tried the following formula:

=SUMPRODUCT(1/COUNTIF($A1:$A1000;$A1:$1000)*(B1:B1000="Food Industry"))

This formula gives me a result with decimals (strange) and which is not accurate.

Do you have any idea what the problem is?

Thank you!

Pimpa

Configuration: Windows / Firefox 72.0

2 réponses

DjiDji59430 Posted messages 4277 Registration date   Status Membre Last intervention   716
 
When you create your pivot table, you need to check the box in the bottom left that says "Add to data model."
But this removes the automatic date formatting.

Regards.
1
LaPimpa Posted messages 7 Status Membre
 
Thank you for your help. I didn’t get anything by adding to the data model, I must not have understood your response, but I went through Power Pivot and it works.

Best regards,
0