# How to count for rows in another table

**URL:** <https://community.glideapps.com/t/how-to-count-for-rows-in-another-table/66564>\
**Category:** Ask for Help\
**Created:** [September 27, 2023, 2:11pm UTC](https://community.glideapps.com/t/how-to-count-for-rows-in-another-table/66564 "2023-09-27T14:11:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dvf061](https://avatars.discourse-cdn.com/v4/letter/d/0ea827/32.png) [@dvf061](https://community.glideapps.com/u/dvf061)\
**Post date:** [September 27, 2023, 2:11pm UTC](https://community.glideapps.com/t/how-to-count-for-rows-in-another-table/66564/1 "2023-09-27T14:11:31Z")

</div>

Hi there,

I have two tables: BEN and EMP. Inside EMP there is a column called empCode, which is also present in BEN. **I would like to create a column in EMP, that will count how many times the empCode matches rows inside BEN empCode column**.

On Excel, I would run this formula `=COUNTIF(ben!C:C,emp!C2)`. When I use the same on Glide, it doesn’t seem to be able to reference items from another table. I also tried the JavaScript feature, but I could not find any docs that describe how to deploy and use a table in there, so I can access it.

Let’s say EMP has two rows and their empCode values are ABC, DEF. Inside BEN there are 8 rows: ABC, DEF, DEF, ABC, DEF, ABC, ABC, DEF. Thereby my column in EMP, lets name it Total, would then need to show 4 in the row that has ABC, and 4 in the row that has DEF.

---

<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 27, 2023, 2:16pm UTC](https://community.glideapps.com/t/how-to-count-for-rows-in-another-table/66564/2 "2023-09-27T14:16:54Z")

</div>

Create two columns in your EMP table:

- First, a multiple relation that matches the empCode with the same column in your BEN table
- Then a rollup column that does a count via the relation column

---

<div class="post-metadata">

**Author:** ![dvf061](https://avatars.discourse-cdn.com/v4/letter/d/0ea827/32.png) [@dvf061](https://community.glideapps.com/u/dvf061)\
**Post date:** [September 27, 2023, 2:26pm UTC](https://community.glideapps.com/t/how-to-count-for-rows-in-another-table/66564/3 "2023-09-27T14:26:15Z")

</div>

> [@Darren\_Murphy](#):
>
> multiple relation

Thanks, this works!

---

<div class="post-metadata">

**Author:** ![dvf061](https://avatars.discourse-cdn.com/v4/letter/d/0ea827/32.png) [@dvf061](https://community.glideapps.com/u/dvf061)\
**Post date:** [September 27, 2023, 2:40pm UTC](https://community.glideapps.com/t/how-to-count-for-rows-in-another-table/66564/4 "2023-09-27T14:40:12Z")

</div>

@Darren_Murphy may I ask more questions or must I make a new topic?

---

<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 27, 2023, 2:59pm UTC](https://community.glideapps.com/t/how-to-count-for-rows-in-another-table/66564/5 "2023-09-27T14:59:19Z")

</div>

Better to make a new topic.

---

<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:** [October 4, 2023, 2:59pm UTC](https://community.glideapps.com/t/how-to-count-for-rows-in-another-table/66564/6 "2023-10-04T14:59:37Z")

</div>

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