Count unique values with condition

LaPimpa Posted messages 7 Status Member -  
LaPimpa Posted messages 7 Status Member -
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 answers

  1. DjiDji59430 Posted messages 4278 Registration date   Status Member Last intervention   718
     
    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
    1. LaPimpa Posted messages 7 Status Member
       
      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