# Count Exact Word Similar in an array

**URL:** <https://community.glideapps.com/t/count-exact-word-similar-in-an-array/49570>\
**Category:** Ask for Help\
**Created:** [September 18, 2022, 1:04pm UTC](https://community.glideapps.com/t/count-exact-word-similar-in-an-array/49570 "2022-09-18T13:04:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yasin\_Hassanien](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/yasin_hassanien/32/9042_2.png) [@Yasin\_Hassanien](https://community.glideapps.com/u/Yasin_Hassanien)\
**Post date:** [September 18, 2022, 1:04pm UTC](https://community.glideapps.com/t/count-exact-word-similar-in-an-array/49570/1 "2022-09-18T13:04:16Z")

</div>

So lets say we have a joined text returned from a relation as the follow

example1,example2,example2,example1,example3

What I need to achieve is in a table of record

example1 found it 2 times  
example2 found it 2 times  
example3 found 1 time

It seems that it can be archived by Java script I didn’t yet try it but I wonder if it can be done by glide yes columns if there is

This will help a lot in reporting

Thanks

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [September 18, 2022, 1:42pm UTC](https://community.glideapps.com/t/count-exact-word-similar-in-an-array/49570/2 "2022-09-18T13:42:36Z")

</div>

I have a Custom Code column that will do this, you are welcome to clone it or use it directly.

- Link to use in Experimental Code Column: `https://mcdarren.github.io/glide-count-keys/`
- GitHub Link: [GitHub - mcdarren/glide-count-keys](https://github.com/mcdarren/glide-count-keys)

It accepts 3 parameters:

- Joined List of values (as per your example)
- Joined List of Items to search
- (Optional) Number of Items in the first list to use for the search

To use it for your case, you’d need multiple rows - one for each item in the list you want to count.

Here is how it would look:

 ![Screen Shot 2022-09-18 at 9.41.00 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/9/7989568595a348c84effa14e181b283ce6e90af5.png)

And the Code Column configuration:

 ![Screen Shot 2022-09-18 at 9.41.17 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/1/41dccbcadb68e42325e88182ac2792f033bd132d.png)

_Note: This code column was written for a completely different use case, so it’s probably overkill for what you want to do. But it will still get the job done._

---

<div class="post-metadata">

**Author:** ![Yasin\_Hassanien](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/yasin_hassanien/32/9042_2.png) [@Yasin\_Hassanien](https://community.glideapps.com/u/Yasin_Hassanien)\
**Post date:** [September 18, 2022, 2:34pm UTC](https://community.glideapps.com/t/count-exact-word-similar-in-an-array/49570/3 "2022-09-18T14:34:36Z")

</div>

> [@Darren\_Murphy](#):
>
> [Glide Yes-Code](https://mcdarren.github.io/glide-count-keys/)

Am using the same method in javascript somehow like the below

````auto
let myString = p1;
let mySubString = p2;

let count = myString.split(mySubString).length - 1;
return count; 
```/
what do you think should I use the yes column better or the JS ?
````

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [September 18, 2022, 2:38pm UTC](https://community.glideapps.com/t/count-exact-word-similar-in-an-array/49570/4 "2022-09-18T14:38:26Z")

</div>

For simple things like this, I think a JavaScript column is fine.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [September 18, 2022, 4:05pm UTC](https://community.glideapps.com/t/count-exact-word-similar-in-an-array/49570/6 "2022-09-18T16:05:33Z")

</div>

Interesting.

Would you mind sharing the JavaScript snippet that caused this behaviour?

As a general rule, I try to use my own JavaScript (both the plugin and the external code column) sparingly. I’ll usually only write my own code if I can’t find any other way to do it with standard computed columns, or if it will save me a bunch of columns. Also, my JavaScript skills are intermediate at best, so I’d rather place my trust in code written by Glide Engineers than my own 😉

---

<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:** [September 18, 2022, 4:13pm UTC](https://community.glideapps.com/t/count-exact-word-similar-in-an-array/49570/7 "2022-09-18T16:13:05Z")

</div>

Let me rewrite it again and retest it with a GT old version that I have.

I will let you know it but the code was harmless 🙄

---

<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:** [September 18, 2022, 4:37pm UTC](https://community.glideapps.com/t/count-exact-word-similar-in-an-array/49570/8 "2022-09-18T16:37:07Z")

</div>

BTW, I have my own version for this 😉

> [@1234 Count duplicate elements in an array or list](https://community.glideapps.com/t/count-duplicate-elements-in-an-array-or-list/41313):
>
> Hola! This is not a feature request per se, instead, it is an easy solution to know how many times an element is in an array or list to use it later and create a ranking, a sorted list, etc. Glide has many array plugins but I don’t know why something like it is missing when I needed it (it’s the reason I created this small code). Maybe the Duplicated Items plugin is closest to get it but it’s not enough. Well, the case could be this: [image] and in order to know how many times a…
