# Count IF solution

**URL:** <https://community.glideapps.com/t/count-if-solution/67186>\
**Category:** Ask for Help\
**Created:** [October 22, 2023, 3:09pm UTC](https://community.glideapps.com/t/count-if-solution/67186 "2023-10-22T15:09:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mauricio\_Gonzalez](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mauricio_gonzalez/32/65524_2.png) [@Mauricio\_Gonzalez](https://community.glideapps.com/u/Mauricio_Gonzalez)\
**Post date:** [October 22, 2023, 3:09pm UTC](https://community.glideapps.com/t/count-if-solution/67186/1 "2023-10-22T15:09:46Z")

</div>

Hi everyone!

This is my first app with Glide and would love some help with a column formula:

**Context:** I am building a reservations internal app. Users will need to add their phone numbers, which has a relation with the users table. I also have a “CANCELLATIONS” in which we submit if a user didn’t attend.

**Problem:** I need a column in the users table that counts how many times this specific user have cancelled.

**Question:** How can I use a similar COUNT IF option to count the number of times a user has cancelled based on how many rows the phone number appears in the “CANCELLATIONS” table?

Thank you in advance! 🙂

---

<div class="post-metadata">

**Author:** ![slscustom.ru](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/slscustom.ru/32/77336_2.png) [@slscustom.ru](https://community.glideapps.com/u/slscustom.ru)\
**Post date:** [October 22, 2023, 3:21pm UTC](https://community.glideapps.com/t/count-if-solution/67186/2 "2023-10-22T15:21:37Z")

</div>

Hi, Mauricio\_Gonzalez!  
I think you can create multiply relation from phone number in User table to phone number in cancelation table and do Rollup count thru this relation

---

<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 22, 2023, 3:25pm UTC](https://community.glideapps.com/t/count-if-solution/67186/3 "2023-10-22T15:25:52Z")

</div>

As @slscustom.ru mentioned, a relation plus rollup will get you what you want.

However, building relations based on user supplied phone numbers is going to be a very fragile solution. If a user enters a space or a leading zero, for example, it will break.

Assuming that your Users will be signed in to your App, you are much better adding the Users email address or UserID (RowID) from their User Profile to your Cancellations table, and use that to create the relation. Either of those can be captured automatically when the cancellation is submitted, so you won’t have to rely on Users always entering the same phone number.

---

<div class="post-metadata">

**Author:** ![Mauricio\_Gonzalez](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mauricio_gonzalez/32/65524_2.png) [@Mauricio\_Gonzalez](https://community.glideapps.com/u/Mauricio_Gonzalez)\
**Post date:** [October 22, 2023, 3:45pm UTC](https://community.glideapps.com/t/count-if-solution/67186/4 "2023-10-22T15:45:57Z")

</div>

Thank you @Darren_Murphy and @slscustom.ru for the prompt responses!

Darren - yes, as for the relation, I was also thinking of utilizing the user ID instead, but my concern is that I might not ask everyone to sign in. This is the main reason why I was hesitant to do it this way. I think I will further think about the relation logic behind this. Thank you again!

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [October 22, 2023, 5:01pm UTC](https://community.glideapps.com/t/count-if-solution/67186/5 "2023-10-22T17:01:42Z")

</div>

> [@Mauricio\_Gonzalez](#):
>
> my concern is that I might not ask everyone to sign in

Hi Mauricio 👋

Asking users to sign in isn’t just a UX “annoyance”. Anytime you want to personalize your app, personalization is associated to a user via a user identifier, which in Glide is an email address (and by extension a Row ID in the Users table).

So you could implement cancelations without a user sign-in and instead us phone numbers as the identifier, but I agree with Darren, building relations on user submissions is fragile. If a reservation isn’t associated to a user via their email address or Row ID, then I would say you don’t have the concept of reservations or cancelations in your app.

---

<div class="post-metadata">

**Author:** ![Mauricio\_Gonzalez](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mauricio_gonzalez/32/65524_2.png) [@Mauricio\_Gonzalez](https://community.glideapps.com/u/Mauricio_Gonzalez)\
**Post date:** [October 22, 2023, 11:49pm UTC](https://community.glideapps.com/t/count-if-solution/67186/6 "2023-10-22T23:49:07Z")

</div>

Thanks @nathanaelb - will adjust to user IDs. Thanks all!

---

<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 29, 2023, 11:49pm UTC](https://community.glideapps.com/t/count-if-solution/67186/7 "2023-10-29T23:49:54Z")

</div>

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