# Count how many times a value appears

**URL:** <https://community.glideapps.com/t/count-how-many-times-a-value-appears/51020>\
**Category:** Ask for Help\
**Created:** [October 6, 2022, 12:22pm UTC](https://community.glideapps.com/t/count-how-many-times-a-value-appears/51020 "2022-10-06T12:22:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexander\_Rubino](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/alexander_rubino/32/48638_2.png) [@Alexander\_Rubino](https://community.glideapps.com/u/Alexander_Rubino)\
**Post date:** [October 6, 2022, 12:22pm UTC](https://community.glideapps.com/t/count-how-many-times-a-value-appears/51020/1 "2022-10-06T12:22:11Z")

</div>

I have a column with different ages. I want to count the amount of time that the ages appear. E.g. a list of [12, 14, 28, 12, 14], I want to return with the values 12 = 2 times, 14 = 2 times & 28 = 1.  
Any help?

---

<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:** [October 6, 2022, 2:13pm UTC](https://community.glideapps.com/t/count-how-many-times-a-value-appears/51020/2 "2022-10-06T14:13:02Z")

</div>

Hola Alexander!

Try with it  
[https://community.glideapps.com/t/count-duplicate-elements-in-an-array-or-list](https://community.glideapps.com/t/count-duplicate-elements-in-an-array-or-list)

---

<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:** [October 6, 2022, 2:22pm UTC](https://community.glideapps.com/t/count-how-many-times-a-value-appears/51020/3 "2022-10-06T14:22:57Z")

</div>

~~I’d be curious about the larger context. How is your array generated in the first place, what do the numbers represent, and what will you do with the results?~~

Actually, I just re-read your question. Amazing how you can read something once and only take part of it in. Anyway…

If these ages are all in a single column, all you need to do is:

- Add a multiple relation column that matches your age column with itself
- Add a rollup column that does a count via the multiple relation column

---

<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:** [October 6, 2022, 2:39pm UTC](https://community.glideapps.com/t/count-how-many-times-a-value-appears/51020/4 "2022-10-06T14:39:04Z")

</div>

> [@Darren\_Murphy](#):
>
> Actually, I just re-read your question. Amazing how you can read something once and only take part of it in. Anyway…

I also suffer this little problem often by reading some curious cases over here 🥴

---

<div class="post-metadata">

**Author:** ![Alexander\_Rubino](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/alexander_rubino/32/48638_2.png) [@Alexander\_Rubino](https://community.glideapps.com/u/Alexander_Rubino)\
**Post date:** [October 6, 2022, 2:46pm UTC](https://community.glideapps.com/t/count-how-many-times-a-value-appears/51020/5 "2022-10-06T14:46:47Z")

</div>

I have used your method. However, it doesn’t seem to work when I put it in a chart. Because I only have 2 users that are 17, but they have seemed to multiply by 2.

 ![Screenshot 2022-10-06 at 16.45.13](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/0/7069c08db81b84880755deeee4105b033fe74856.png)

---

<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:** [October 6, 2022, 3:10pm UTC](https://community.glideapps.com/t/count-how-many-times-a-value-appears/51020/6 "2022-10-06T15:10:17Z")

</div>

Yes, if you’re using the original Age column as the X-Axis on your chart, that is the expected result.

What you would need to do is massage your data a little to create a new column that only contains the unique ages. You can do that as follows:

- Add a RowID column to your table
- Add a Single Value column that takes the first RowID via the relation column that you created earlier.
- Now create an if-then-else column:  
– If Single Value RowID is RowID, then Age

The result of the if-then-else column should be that you get an Age value in some rows, but not all, and there should be no duplicates.

And now you can use the if-then-else column as the X-Axis source of your chart.

---

<div class="post-metadata">

**Author:** ![Alexander\_Rubino](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/alexander_rubino/32/48638_2.png) [@Alexander\_Rubino](https://community.glideapps.com/u/Alexander_Rubino)\
**Post date:** [October 6, 2022, 8:20pm UTC](https://community.glideapps.com/t/count-how-many-times-a-value-appears/51020/7 "2022-10-06T20:20:39Z")

</div>

Can you help me with another thing? I’m trying hard to convert data from a website to google Sheets. I have tried a lot of things, and I want to know if it is possible. Click the link for more info.  
If you succeed, I will be SO gratefull.

Link to the question: [Website to google sheet - #3 by Alexander\_Rubino](https://community.glideapps.com/t/website-to-google-sheet/50920/3)
