# Counting values + sorting

**URL:** <https://community.glideapps.com/t/counting-values-sorting/28907>\
**Category:** Ask for Help\
**Created:** [July 9, 2021, 3:32pm UTC](https://community.glideapps.com/t/counting-values-sorting/28907 "2021-07-09T15:32:09Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fabio\_Leanzi](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/fabio_leanzi/32/6838_2.png) [@Fabio\_Leanzi](https://community.glideapps.com/u/Fabio_Leanzi)\
**Post date:** [July 9, 2021, 3:32pm UTC](https://community.glideapps.com/t/counting-values-sorting/28907/1 "2021-07-09T15:32:09Z")

</div>

I need help with google sheet.  
I need to count the values of the same type, starting from the one with the lowest value to the one with the highest value, like the red column.  
I can’t do it

 ![Schermata 2021-07-09 alle 17.15 copia](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/1/71f527a88005d26c84012cc33959d68f20da92eb.jpeg)

---

<div class="post-metadata">

**Author:** ![Marc-Olivier](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@Marc-Olivier](https://community.glideapps.com/u/Marc-Olivier)\
**Post date:** [July 9, 2021, 3:40pm UTC](https://community.glideapps.com/t/counting-values-sorting/28907/2 "2021-07-09T15:40:34Z")

</div>

Can you elaborate what you want with an exemple? like count the values of which column (same type)

---

<div class="post-metadata">

**Author:** ![fabio](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/fabio/32/16336_2.png) [@fabio](https://community.glideapps.com/u/fabio)\
**Post date:** [July 9, 2021, 3:41pm UTC](https://community.glideapps.com/t/counting-values-sorting/28907/3 "2021-07-09T15:41:03Z")

</div>

Se ho capito bene cosa vuoi fare, puoi farlo, credo, con la funzione “query” in google sheet.

If I understood correctly what you mean, you could probably do it with “query” function in Google sheet

something like =query(A2:F;“select count(E) group by E Asc”;-1)

> **[How to Sum, Avg, Count, Max, and Min in Google Sheets Query](https://infoinspired.com/google-docs/spreadsheet/aggregation-function-in-google-sheets-query/)**
>
> Without learning how to do aggregation in Google Sheets Query, you can't well manipulate your data. There are aggregation function equivalents in Query.

[https://www.benlcollins.com/spreadsheets/google-sheets-query-sql/](https://www.benlcollins.com/spreadsheets/google-sheets-query-sql/)

have a look

---

<div class="post-metadata">

**Author:** ![Fabio\_Leanzi](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/fabio_leanzi/32/6838_2.png) [@Fabio\_Leanzi](https://community.glideapps.com/u/Fabio_Leanzi)\
**Post date:** [July 9, 2021, 3:49pm UTC](https://community.glideapps.com/t/counting-values-sorting/28907/4 "2021-07-09T15:49:15Z")

</div>

> [@Marc-Olivier](#):
>
> Can you elaborate what you want with an exemple? like count the values of which column (same type)

Oh yes,  
Example:  
I enter three values of the same category: A4  
the first A4-1 value will be: 4  
the second A4-2 value will be: 12  
the third value A4-3 will be: 5

I need to create a new column with the numbering from the smallest number to the largest number always starting from 1  
The column should look like this:  
A4-1: 1  
A4-2: 3  
A4-3: 2

---

<div class="post-metadata">

**Author:** ![Marc-Olivier](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@Marc-Olivier](https://community.glideapps.com/u/Marc-Olivier)\
**Post date:** [July 9, 2021, 3:54pm UTC](https://community.glideapps.com/t/counting-values-sorting/28907/5 "2021-07-09T15:54:29Z")

</div>

ok get it you need to rank items of the same category depending on the value. Send me the link of a simple google sheet with your data

---

<div class="post-metadata">

**Author:** ![Fabio\_Leanzi](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/fabio_leanzi/32/6838_2.png) [@Fabio\_Leanzi](https://community.glideapps.com/u/Fabio_Leanzi)\
**Post date:** [July 9, 2021, 4:00pm UTC](https://community.glideapps.com/t/counting-values-sorting/28907/6 "2021-07-09T16:00:55Z")

</div>

Tnxm this is the sheet: [Test - Google Sheets](https://docs.google.com/spreadsheets/d/1X-h5hlBn5_qdR11_xbI0lPmATCkvK0cTy_31_PeSJps/edit?usp=sharing)

---

<div class="post-metadata">

**Author:** ![Marc-Olivier](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@Marc-Olivier](https://community.glideapps.com/u/Marc-Olivier)\
**Post date:** [July 9, 2021, 4:19pm UTC](https://community.glideapps.com/t/counting-values-sorting/28907/8 "2021-07-09T16:19:00Z")

</div>

use this  
=RANK(C2,filter(A:C,A:A=A2),1) but you will have to copy it doesn’t work with arrayformula

---

<div class="post-metadata">

**Author:** ![Fabio\_Leanzi](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/fabio_leanzi/32/6838_2.png) [@Fabio\_Leanzi](https://community.glideapps.com/u/Fabio_Leanzi)\
**Post date:** [July 10, 2021, 7:30am UTC](https://community.glideapps.com/t/counting-values-sorting/28907/9 "2021-07-10T07:30:47Z")

</div>

Tnx!  
i didn’t know the rank function, i found a script that works in array

```auto
=ARRAYFORMULA(RANK(ARRAY_CONSTRAIN(VLOOKUP(Lavorazioni!A2:A,{UNIQUE(FILTER(Lavorazioni!A2:A,Lavorazioni!A2:A<>"")),ROW(INDIRECT("a1:a"&COUNTUNIQUE(Lavorazioni!A2:A)))},2,)*1000+Lavorazioni!B2:B,COUNTA(Lavorazioni!A2:A),1),ARRAY_CONSTRAIN(VLOOKUP(Lavorazioni!A2:A,{UNIQUE(FILTER(Lavorazioni!A2:A,Lavorazioni!A2:A<>"")),ROW(INDIRECT("a1:a"&COUNTUNIQUE(Lavorazioni!A2:A)))},2,)*1000+Lavorazioni!B2:B,COUNTA(Lavorazioni!A2:A),1),1) - COUNTIF(Lavorazioni!A2:A,"<"&OFFSET(A2,,,COUNTA(Lavorazioni!A2:A))))

```

---

<div class="post-metadata">

**Author:** ![Marc-Olivier](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@Marc-Olivier](https://community.glideapps.com/u/Marc-Olivier)\
**Post date:** [July 10, 2021, 11:50am UTC](https://community.glideapps.com/t/counting-values-sorting/28907/10 "2021-07-10T11:50:41Z")

</div>

Thanks for the tip! I didn’t know either

---

<div class="post-metadata">

**Author:** ![NoCodeAndy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nocodeandy/32/62530_2.png) [@NoCodeAndy](https://community.glideapps.com/u/NoCodeAndy)\
**Post date:** [January 17, 2024, 4:51pm UTC](https://community.glideapps.com/t/counting-values-sorting/28907/11 "2024-01-17T16:51:27Z")

</div>


