# Grouping on Multiple Columns

**URL:** <https://community.glideapps.com/t/grouping-on-multiple-columns/15812>\
**Category:** Ask for Help\
**Created:** [September 15, 2020, 11:42am UTC](https://community.glideapps.com/t/grouping-on-multiple-columns/15812 "2020-09-15T11:42:35Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jason\_Szumlanski](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jason_szumlanski/32/13596_2.png) [@Jason\_Szumlanski](https://community.glideapps.com/u/Jason_Szumlanski)\
**Post date:** [September 15, 2020, 11:42am UTC](https://community.glideapps.com/t/grouping-on-multiple-columns/15812/1 "2020-09-15T11:42:35Z")

</div>

Let’s say I have these columns:

Address | Primary Agent | Secondary Agent

The address is a unique entry, one per row. Each Agent shows up for several Addresses on the sheet. There are several other detail columns, but it is not important for this question. Now I want a tab that lists all Addresses in a list or cards, but I want it grouped by each Agent. So the address will essentially have to show up twice on the tab (unless no Secondary Agent is listed). The Address (and details) will be listed once under each Agent.

Is this possible?

---

<div class="post-metadata">

**Author:** ![Deena](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/deena/32/9877_2.png) [@Deena](https://community.glideapps.com/u/Deena)\
**Post date:** [September 15, 2020, 11:49am UTC](https://community.glideapps.com/t/grouping-on-multiple-columns/15812/2 "2020-09-15T11:49:52Z")

</div>

Hi Jason! Yes, with the “group by” feature, you should be able to group by agent. Add the inline list and then click on Features\>Group by…you should have every column in your sheet available and you can select Agent.

---

<div class="post-metadata">

**Author:** ![Jason\_Szumlanski](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jason_szumlanski/32/13596_2.png) [@Jason\_Szumlanski](https://community.glideapps.com/u/Jason_Szumlanski)\
**Post date:** [September 15, 2020, 12:02pm UTC](https://community.glideapps.com/t/grouping-on-multiple-columns/15812/3 "2020-09-15T12:02:51Z")

</div>

Yes, but you can only group on a single column that way. I want to group on two columns as if they were one.

---

<div class="post-metadata">

**Author:** ![Deena](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/deena/32/9877_2.png) [@Deena](https://community.glideapps.com/u/Deena)\
**Post date:** [September 15, 2020, 12:06pm UTC](https://community.glideapps.com/t/grouping-on-multiple-columns/15812/4 "2020-09-15T12:06:02Z")

</div>

Ah, sorry, missed that…no, you can only group by one column…you can see if using the in app sort/filter is an option for users to find what they want.

---

<div class="post-metadata">

**Author:** ![Jason\_Szumlanski](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jason_szumlanski/32/13596_2.png) [@Jason\_Szumlanski](https://community.glideapps.com/u/Jason_Szumlanski)\
**Post date:** [September 15, 2020, 12:13pm UTC](https://community.glideapps.com/t/grouping-on-multiple-columns/15812/5 "2020-09-15T12:13:13Z")

</div>

I was hoping I could do something with relations or array formulas, but I’m stumped. Without completely reworking my data I can’t figure it out, and I need to keep it this way for printout purposes.

---

<div class="post-metadata">

**Author:** ![Deena](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/deena/32/9877_2.png) [@Deena](https://community.glideapps.com/u/Deena)\
**Post date:** [September 15, 2020, 12:14pm UTC](https://community.glideapps.com/t/grouping-on-multiple-columns/15812/6 "2020-09-15T12:14:27Z")

</div>

@Jeff_Hager or @ThinhDinh are the experts on array formulas and spreadsheet magic. Let’s see if they have an idea.

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [September 15, 2020, 12:22pm UTC](https://community.glideapps.com/t/grouping-on-multiple-columns/15812/7 "2020-09-15T12:22:50Z")

</div>

Do you have your agent columns set up as an array? (Ex. ‘Agent 1’, ‘Agent 2’)

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [September 15, 2020, 12:31pm UTC](https://community.glideapps.com/t/grouping-on-multiple-columns/15812/8 "2020-09-15T12:31:28Z")

</div>

Just tried array. Couldn’t wrap my head around it this early.

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [September 15, 2020, 12:33pm UTC](https://community.glideapps.com/t/grouping-on-multiple-columns/15812/9 "2020-09-15T12:33:59Z")

</div>

No luck @Robert_Petitto? I haven’t tried it yet.

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [September 15, 2020, 12:35pm UTC](https://community.glideapps.com/t/grouping-on-multiple-columns/15812/10 "2020-09-15T12:35:45Z")

</div>

The array column isn’t available as an option for grouping. Probably the same reason why it’s not available as a choice component. Values need to be on their own rows.

But if anyone can find a way, it’s probably you. You’re the king of relations.

---

<div class="post-metadata">

**Author:** ![Jason\_Szumlanski](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jason_szumlanski/32/13596_2.png) [@Jason\_Szumlanski](https://community.glideapps.com/u/Jason_Szumlanski)\
**Post date:** [September 15, 2020, 12:47pm UTC](https://community.glideapps.com/t/grouping-on-multiple-columns/15812/11 "2020-09-15T12:47:40Z")

</div>

I don’t. And I can’t. I need to have a row titles the way they are for presentation purposes.

---

<div class="post-metadata">

**Author:** ![Pratik\_Shah](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pratik_shah/32/12416_2.png) [@Pratik\_Shah](https://community.glideapps.com/u/Pratik_Shah)\
**Post date:** [September 15, 2020, 1:05pm UTC](https://community.glideapps.com/t/grouping-on-multiple-columns/15812/12 "2020-09-15T13:05:00Z")

</div>

Hi Jason, can you share your sheet with demo details?

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [September 15, 2020, 1:47pm UTC](https://community.glideapps.com/t/grouping-on-multiple-columns/15812/13 "2020-09-15T13:47:51Z")

</div>

@Robert_Petitto yeah I see that now.

@Jason_Szumlanski I think the problem here is that we would be trying to pull an extra row out of thin air by making an address row first show for the Primary Agent and then make the same row reappear again for the Secondary Agent. That’s just not how glide works. I would maybe consider a details layout with two inline lists. One grouped by Primary Agent and one grouped by Secondary Agent. If I recall, a Group By will skip any rows that have a blank value for the column being grouped. So if your Primary Agent is always filled, all rows will show in the first inline list, but for the second inline list, only the rows that have a Secondary Agent will show. The only problem is you won’t be able to alphabetically sort both lists together.

---

<div class="post-metadata">

**Author:** ![Jason\_Szumlanski](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jason_szumlanski/32/13596_2.png) [@Jason\_Szumlanski](https://community.glideapps.com/u/Jason_Szumlanski)\
**Post date:** [September 15, 2020, 2:02pm UTC](https://community.glideapps.com/t/grouping-on-multiple-columns/15812/14 "2020-09-15T14:02:07Z")

</div>

Okay, that might be my only option. Sounds reasonable. Not exactly what I had hoped but understandable.

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [September 15, 2020, 2:08pm UTC](https://community.glideapps.com/t/grouping-on-multiple-columns/15812/15 "2020-09-15T14:08:20Z")

</div>

If I think of something different, I’ll let you know.
