# \[Solved\] How to count occurrences of an item in a list?

**URL:** <https://community.thunkable.com/t/solved-how-to-count-occurrences-of-an-item-in-a-list/475824>\
**Category:** Questions about Thunkable X\
**Tags:** solved, list\
**Created:** [February 20, 2020, 8:18pm UTC](https://community.thunkable.com/t/solved-how-to-count-occurrences-of-an-item-in-a-list/475824 "2020-02-20T20:18:36Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![sinisterra2101hlo](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@sinisterra2101hlo](https://community.thunkable.com/u/sinisterra2101hlo)\
**Post date:** [February 20, 2020, 8:18pm UTC](https://community.thunkable.com/t/solved-how-to-count-occurrences-of-an-item-in-a-list/475824/1 "2020-02-20T20:18:36Z")

</div>

I’m trying to know how many times is an item repeated in a list. I’ll appreciate any kind of help. Thanks!

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [February 20, 2020, 9:16pm UTC](https://community.thunkable.com/t/solved-how-to-count-occurrences-of-an-item-in-a-list/475824/2 "2020-02-20T21:16:07Z")

</div>

Create a helper variable “x”

Throw the list into a list loop “for each item in list j” block.

Use logic in the loop

If j = “text input”

Change var x by 1

Else

Continue to next iteration

Now, X should equal the number of duplicates any given item you put into “text input”

---

<div class="post-metadata">

**Author:** ![sinisterra2101hlo](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@sinisterra2101hlo](https://community.thunkable.com/u/sinisterra2101hlo)\
**Post date:** [February 20, 2020, 9:20pm UTC](https://community.thunkable.com/t/solved-how-to-count-occurrences-of-an-item-in-a-list/475824/3 "2020-02-20T21:20:45Z")

</div>

Thanks! But I don’t want to compare it to a text input, but to itself. So would it be if J = J?

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [February 20, 2020, 9:22pm UTC](https://community.thunkable.com/t/solved-how-to-count-occurrences-of-an-item-in-a-list/475824/4 "2020-02-20T21:22:40Z")

</div>

Good thinking, but No. That will always equal true. Are you trying to find the number of duplicates for each item. Or is the list only composed of 1 item, simply repeated multiple times.

Perhaps some extra info about what you are trying to accomplish plus be helpful?

---

<div class="post-metadata">

**Author:** ![sinisterra2101hlo](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@sinisterra2101hlo](https://community.thunkable.com/u/sinisterra2101hlo)\
**Post date:** [February 20, 2020, 9:39pm UTC](https://community.thunkable.com/t/solved-how-to-count-occurrences-of-an-item-in-a-list/475824/5 "2020-02-20T21:39:10Z")

</div>

Sure. So I have an AirTable with 2 columns. Column #1 is for Task and Column #2 is for Date. So basically I want to know how many tasks I have for ‘x’ date, so I need to know how many times is ‘x’ is repeated. Hope you understand! Thanks by the way! 😄

---

<div class="post-metadata">

**Author:** ![sinisterra2101hlo](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@sinisterra2101hlo](https://community.thunkable.com/u/sinisterra2101hlo)\
**Post date:** [February 20, 2020, 9:50pm UTC](https://community.thunkable.com/t/solved-how-to-count-occurrences-of-an-item-in-a-list/475824/6 "2020-02-20T21:50:16Z")

</div>

It’s important to say I don’t want to manually search for repeated items. Instead, I want the app to automatically search for dates that have more than 3 tasks assigned and alert the user. (There can not be more than 3 tasks for one date).

---

<div class="post-metadata">

**Author:** ![sinisterra2101hlo](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@sinisterra2101hlo](https://community.thunkable.com/u/sinisterra2101hlo)\
**Post date:** [February 20, 2020, 9:52pm UTC](https://community.thunkable.com/t/solved-how-to-count-occurrences-of-an-item-in-a-list/475824/7 "2020-02-20T21:52:44Z")

</div>

For example: If user adds a task for tomorrow and there are already 3 tasks for tomorrow, then tell the user there are already 3 tasks for tomorrow!

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [February 20, 2020, 10:18pm UTC](https://community.thunkable.com/t/solved-how-to-count-occurrences-of-an-item-in-a-list/475824/8 "2020-02-20T22:18:09Z")

</div>

Why are you organizing your tasks like this?

_Column 1\_\_\_\_\_\_\_Column 2_  
Take out trash\_\_\_\_2/20/20  
Wash dishes\_\_\_\_\_2/20/20

When you could instead organize them like this:

_Column 1\_\_\_\_\_Column 2\_\_\_\_\_\_\_\_\_Column 3_  
2/20/20\_\_\_\_\_\_\_Take out trash\_\_\_\_\_Wash dishes

If you have all of the tasks for a single date in a single row then you just count the length of the row or find the first blank cell and then you know how many tasks you have.

---

<div class="post-metadata">

**Author:** ![sinisterra2101hlo](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@sinisterra2101hlo](https://community.thunkable.com/u/sinisterra2101hlo)\
**Post date:** [February 20, 2020, 10:55pm UTC](https://community.thunkable.com/t/solved-how-to-count-occurrences-of-an-item-in-a-list/475824/9 "2020-02-20T22:55:28Z")

</div>

I get what you are saying, but it would make things weird and messy! Thanks anyway!

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [February 21, 2020, 1:40am UTC](https://community.thunkable.com/t/solved-how-to-count-occurrences-of-an-item-in-a-list/475824/10 "2020-02-21T01:40:06Z")

</div>

It sounds like you can ignore the task column, right? You just need to count the number of times a specific date appears in one column. That shouldn’t be too hard.

This should work although when I Live Test it, it returns twice the value it should (6 instead of 3):

![Screen Shot 2020-02-20 at 5.24.41 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/6/46ad82c8d41504eb659896e66eab50b255373ce1.png)

I used this Airtable spreadsheet:

![Screen Shot 2020-02-20 at 5.27.12 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/d/2d5090e7f586e37962d50d41a21946f1c5338abf.png)

---

<div class="post-metadata">

**Author:** ![sinisterra2101hlo](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@sinisterra2101hlo](https://community.thunkable.com/u/sinisterra2101hlo)\
**Post date:** [February 21, 2020, 3:57am UTC](https://community.thunkable.com/t/solved-how-to-count-occurrences-of-an-item-in-a-list/475824/11 "2020-02-21T03:57:30Z")

</div>

Thank you very much! I will try different things!

---

<div class="post-metadata">

**Author:** ![blue10abc](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/blue10abc/32/145060_2.png) [@blue10abc](https://community.thunkable.com/u/blue10abc)\
**Post date:** [December 31, 2022, 8:25pm UTC](https://community.thunkable.com/t/solved-how-to-count-occurrences-of-an-item-in-a-list/475824/12 "2022-12-31T20:25:10Z")

</div>

How do you get the airtable spreadsheet?

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [January 1, 2023, 4:15am UTC](https://community.thunkable.com/t/solved-how-to-count-occurrences-of-an-item-in-a-list/475824/13 "2023-01-01T04:15:34Z")

</div>

Sign up for an [Airtable.com](http://Airtable.com) account and then type in the values you need.

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 11:40am UTC](https://community.thunkable.com/t/solved-how-to-count-occurrences-of-an-item-in-a-list/475824/14 "2024-11-08T11:40:54Z")

</div>


