# Can i count the number of repeated items in array column

**URL:** https://community.glideapps.com/t/can-i-count-the-number-of-repeated-items-in-array-column/42132
**Category:** Ask for Help
**Created:** [May 19, 2022, 12:08am UTC](https://community.glideapps.com/t/can-i-count-the-number-of-repeated-items-in-array-column/42132 "2022-05-19T00:08:54Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Hani\_Ibrahim](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/hani_ibrahim/32/42108_2.png) [@Hani\_Ibrahim](https://community.glideapps.com/u/Hani_Ibrahim)
#### Post date: [May 19, 2022, 12:08am UTC](https://community.glideapps.com/t/can-i-count-the-number-of-repeated-items-in-array-column/42132/1 "2022-05-19T00:08:54Z")

</div>

Hello,  
I have the below lookup column with data array, Can i count how many “C” and how many “D” etc.  
 ![Count Reply by Code](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/0/80d823f949383b8f31f682cde368bae228a52f48.jpeg)  
Thank you

---

<div class="post-metadata">

### Author: ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)
#### Post date: [May 19, 2022, 12:28am UTC](https://community.glideapps.com/t/can-i-count-the-number-of-repeated-items-in-array-column/42132/2 "2022-05-19T00:28:24Z")

</div>

Steps to reproduce:

- Create a joined list column from the array, returning it in a form like this: “C, C, C, C, C, C , D, C, C, B, C” (just an example, not the same as your image")

- Add a JavaScript column and use this code.

```auto
let arr = p1.split(", ");
let count = 0;

for (i = 0; i < arr.length; i++) {
if(arr[i] == p2) {
count += 1;
}
}

return count;

```

Then use p1 as the list, p2 as the text you want to count the number of occurrences for.

---

<div class="post-metadata">

### Author: ![Hani\_Ibrahim](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/hani_ibrahim/32/42108_2.png) [@Hani\_Ibrahim](https://community.glideapps.com/u/Hani_Ibrahim)
#### Post date: [May 19, 2022, 12:32am UTC](https://community.glideapps.com/t/can-i-count-the-number-of-repeated-items-in-array-column/42132/3 "2022-05-19T00:32:21Z")

</div>

First of all, Congratulation to the new Professional Title “Certified” you really deserve more.

to be Honest, i would never come up with such solution in my own.  
Really thank you

---

<div class="post-metadata">

### Author: ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)
#### Post date: [May 19, 2022, 4:39am UTC](https://community.glideapps.com/t/can-i-count-the-number-of-repeated-items-in-array-column/42132/4 "2022-05-19T04:39:04Z")

</div>

Hola @Hani_Ibrahim

If you want to test another workaround, you can take a look at this [🔢 Count duplicate elements in an array or list](https://community.glideapps.com/t/count-duplicate-elements-in-an-array-or-list/41313)

Both solutions work fine, no problem with Thinh’s one.

---

<div class="post-metadata">

### Author: ![Hani\_Ibrahim](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/hani_ibrahim/32/42108_2.png) [@Hani\_Ibrahim](https://community.glideapps.com/u/Hani_Ibrahim)
#### Post date: [May 19, 2022, 10:46am UTC](https://community.glideapps.com/t/can-i-count-the-number-of-repeated-items-in-array-column/42132/5 "2022-05-19T10:46:17Z")

</div>

i will try that too.

Thank you for your continues support.

---

<div class="post-metadata">

### Author: ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)
#### Post date: [May 20, 2022, 10:46am UTC](https://community.glideapps.com/t/can-i-count-the-number-of-repeated-items-in-array-column/42132/6 "2022-05-20T10:46:25Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
