TransWikia.com

How can I count unique values in Excel?

Super User Asked by Berg_Durden on January 14, 2021

I have these tables:

Table 1:

enter image description here

Table 2:

enter image description here

The column ‘Acertos’ (the last one) in the table 1 counts how many values of the table 2 contains in it, in other words, when I add a number into the table 2, the column ‘Acertos’ will check to see if such number exists in the range B-H.

I am using this formula: =SUM(COUNTIF($O$2:$T$6,C2:H2))

It sort of does what I want, but it also counts the repeated values. As you can see, Ana only hit 2 and 4, so, Acertos should be 2, but since there are three 4 and two 2 in the table 2, Acertos is counting 5.

I found this tutorial: https://www.youtube.com/watch?v=kJFeQQOfu0k&ab_channel=dptutorials

It counts only unique numbers, but it only checks the table based on the numbers that still are in there, I need to check it based on another table.

I’ve tried to make some adaptations but without any success, since I am new on Excel and I am a bit lost.

How can I do that?

One Answer

You can use this formula in Table 1:

=SUM(INT(COUNTIF($O$2:$T$6,Table1[@[Num 1]:[Num 6]])>0))

Your original COUNTIF gives this:

enter image description here

Making it "unique", you just test if each cell in the array is greater than zero, like this:

enter image description here

Convert it back into 1 and 0:

enter image description here

And then sum to give the final formula.

Correct answer by FlexYourData on January 14, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP