# Countif in Glide?

**URL:** <https://community.glideapps.com/t/countif-in-glide/31036>\
**Category:** Ask for Help\
**Created:** [August 27, 2021, 2:18pm UTC](https://community.glideapps.com/t/countif-in-glide/31036 "2021-08-27T14:18:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)\
**Post date:** [August 27, 2021, 2:18pm UTC](https://community.glideapps.com/t/countif-in-glide/31036/1 "2021-08-27T14:18:54Z")

</div>

Is it possible to replace this countifs formula with something Glide computed? (Without using YC)

```auto
=ARRAYFORMULA(if(isblank(A2:A),"",if(if(A2:A=A2:A,COUNTIFS(A2:A,A2:A,ROW(A2:A),"<="&ROW(A2:A)),)=1,"1","2")))

```

 ![Screen Shot 2021-08-27 at 10.17.21 AM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/a/3/a32884c8b36b5e740dba40ba7f74471d6f79f048.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:** [August 27, 2021, 2:30pm UTC](https://community.glideapps.com/t/countif-in-glide/31036/2 "2021-08-27T14:30:30Z")

</div>

Yes, of course.  
Just create a self-referencing multi-relation on the names column, and then a roll up on that to get a count.

---

<div class="post-metadata">

**Author:** ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)\
**Post date:** [August 27, 2021, 2:33pm UTC](https://community.glideapps.com/t/countif-in-glide/31036/3 "2021-08-27T14:33:47Z")

</div>

That gives me the total count or a unique count. What I’m looking for is the first time the Name appears count = 1 and the second time the Name appears count = 2

---

<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:** [August 27, 2021, 2:36pm UTC](https://community.glideapps.com/t/countif-in-glide/31036/4 "2021-08-27T14:36:56Z")

</div>

ah, right. Let me think about that for a bit

---

<div class="post-metadata">

**Author:** ![Amal](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/amal/32/15421_2.png) [@Amal](https://community.glideapps.com/u/Amal)\
**Post date:** [August 27, 2021, 4:44pm UTC](https://community.glideapps.com/t/countif-in-glide/31036/5 "2021-08-27T16:44:39Z")

</div>

What is the end result you are looking for? if you describe that, it will be easier for us to give you a solution. G sheet logic doesn’t always translate well to glide functions, but there is a elegant way to do it, if we know what u are trying to achieve.

---

<div class="post-metadata">

**Author:** ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)\
**Post date:** [August 27, 2021, 5:18pm UTC](https://community.glideapps.com/t/countif-in-glide/31036/6 "2021-08-27T17:18:44Z")

</div>

First I make a duplicate set of names using a Query in GS. Then using the countifs formula I’m able to flag the first and second occurrence. Finally in glide using if-then-else I can control the left and right side column values in an inline list X2 per row.

i.e. If count=1 Last Week if Count=2 This Week

Sort of like a Button Bar but I need a Card Style Layout. I have the desired functionality, I’m just a big fan of getting rid of formulas and this one is referenced a lot.

 ![Screen Shot 2021-08-27 at 1.10.58 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/6/7/678e73e84518e23e0d4033e266cceee318f8ded1.png)
