Count how many cells in a table have the same value

Hello,

I have created a table, each cell in the table contains a number. Some cells in the table have a number the same as another cell, some cells have a number the same as ten other cells, some cells have a number which is unique.

I want to create a new table, which lists each unique number in one column, and in the second column, the amount of instances (repetitions) of that number.

for example if the table is : 7 4 7 2 7

the resulting new table will show:

7 3 (the number 7 occurs 3 times)
4 1 (the number 4 occurs 1 time)
2 1 (the number 2 occurs 1 time)

How can I perform this count ish type of function using a textDAT or tableDAT.

Any assistance is appreciated,
Anthony.

Hi there,

I’m not sure it’s the best approach, but you could convert the values to a CHOP, then use an analyse CHOP to find the duplicates, convert it back to a DAT and sort the unique values.
Something like the attachment.

Hope this helps.
Cheers,
tim
CountValues.tox (670 Bytes)

Hey there,

If you are familiar with Python, a simpler approach in my opinion is just to write a little script. Find attached a possible solution. Run the “text_computeOccurances” in the tox

Best,
Darien
countItems.tox (646 Bytes)

2 Likes

Thanks!
best
Janco