# How would I duplicate a sheet to only show an updated list of the 'last 10 items logged by each user'

**URL:** <https://community.glideapps.com/t/how-would-i-duplicate-a-sheet-to-only-show-an-updated-list-of-the-last-10-items-logged-by-each-user/12234>\
**Category:** Ask for Help\
**Created:** [July 9, 2020, 11:32pm UTC](https://community.glideapps.com/t/how-would-i-duplicate-a-sheet-to-only-show-an-updated-list-of-the-last-10-items-logged-by-each-user/12234 "2020-07-09T23:32:34Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [July 10, 2020, 1:34am UTC](https://community.glideapps.com/t/how-would-i-duplicate-a-sheet-to-only-show-an-updated-list-of-the-last-10-items-logged-by-each-user/12234/2 "2020-07-10T01:34:47Z")

</div>

Hi Jaime, this was a bit of a tricky one.

I’m used to group-wise ranking in SQL but have never tried this in Google Sheets, interesting use case.

For this one I have 2 steps:

- Ranking group-wise by a script (as Arrayformula, Rank and If can’t work together in my experience).

- Query to return only rankings less than or equal a pre-defined number.

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/0/0f3c3abfd867d0c975046d53fa442135631d06a9.png)

In this example I tried to return 3 latest entries for each type of user (A & B).

The script I used for the custom function:

```
  function customrank(arr) {
  arr = arr.filter(function(r) {
    return r[0] != "";
  });
  return arr.map(function(r1) {
    return arr.reduce(function(rank, r2) {
      return rank += (r2[0] == r1[0] && r2[1] > r1[1]);
    }, 1);
  });
}

```

The link to the Sheet is [here]([https://docs.google.com/spreadsheets/d/1sEQHpSKyHx9w2F\_Xx3lm56SU1p-8eI81OYU5TYvQFvw/edit#gid=119936354](https://docs.google.com/spreadsheets/d/1sEQHpSKyHx9w2F_Xx3lm56SU1p-8eI81OYU5TYvQFvw/edit#gid=119936354).

---

_[View the full topic](https://community.glideapps.com/t/how-would-i-duplicate-a-sheet-to-only-show-an-updated-list-of-the-last-10-items-logged-by-each-user/12234)._
