Static table row numbering regardless of sort/filter
Asked by Joachim Martin:

I'd like to show 1-N on my table regardless of sorting or filtering. I just want a visual indicator so that in meetings people can refer to "row 5" in the current view.

With Table Filter, it is Dynamic in that it recalculates after filtering, but not after sorting.

Any way to do this?

More info:

I'm looking for something like the =SUBTOTAL(3,B2:$B$2) rownumbering trick in Excel.

Basically regardless of sort or filter, I want the first row of the table to be numbered 1, second 2, etc.


Answers:
author: Sayed Bares [ServiceRocket]
body: [@Joachim Martin](/t5/user/viewprofilepage/user-id/5276508) I would suggest adding a new column to add the number for your dataset manually so this way it will always be static even if it is sorted or filtered.

comments: author: Stiltsoft support
body: Hi [@Joachim Martin](/t5/user/viewprofilepage/user-id/5276508) ,

You may use standard Confluence numbered column option for your table and leave the numbering row type field inside the Table Filter macro blank.

Then if you sort or filter your table through the macro, the row numbers will remain as they are.


author: Joachim Martin
body: I'm looking for something like the =SUBTOTAL(3,B2:$B$2) rownumbering trick in Excel.

Basically regardless of sort or filter, I want the first row of the table to be numbered 1, second 2, etc.

May not be possible but thought I'd ask the experts!


author: Stiltsoft support
body: Hi [@Joachim Martin](/t5/user/viewprofilepage/user-id/5276508) ,

The [Table Spreadsheet](https://docs.stiltsoft.com/tfac/cloud/how-to-use-table-spreadsheet-macro-83100938.html?utm_source=atl_community&utm_medium=answer&utm_campaign=table-filter-traffic-sources&utm_vendorID=1216111) macro supports the =SUBTOTAL(3, ...) function.

But it seems that I'm getting the idea wrong. :)

In my A column I have data and in the B column I try to create row numbers:

=SUBTOTAL(3,$A$2:A2)

=SUBTOTAL(3,$A$2:A3)

=SUBTOTAL(3,$A$2:A4)

I get 1, 2 and 3 that is correct.

But when sorting or filtering, the row numbers change and they are not static (both for Excel and Table Spreadsheet).

As I know, the =SUBTOTAL(3, ...) function equals the =COUNTA function that counts not empty cells in the range.

So, when sorting, only "strict" formulas work for me:

=SUBTOTAL(3,$A$2:$A$2)

=SUBTOTAL(3,$A$2:$A$3)

=SUBTOTAL(3,$A$2:$A$4)

What concerns filtering, even "strict" formulas break the numbering. I've found in Excel documentation that =SUBTOTAL(3, ...) function includes and =SUBTOTAL(103, ...) function ignores ++manually++ hidden rows. But the ++"filtered out" rows are always ignored++. So, it seems that I get the correct behavior.

So, if you get the case to work, please share with us and future readers of this question.


author: Joachim Martin
body: I am trying to add this row number to a Page Properties Report. So I don't think the Table Spreadsheet will work.

Here's what I'm looking for

Initial

![2023-08-01_16-39-48.png](https://community.atlassian.com/t5/image/serverpage/image-id/272584i8530DAA61CCAEA12/image-size/large?v=v2&px=999 "2023-08-01_16-39-48.png")

After filtering I still get 1,2,3

![2023-08-01_16-43-20.png](https://community.atlassian.com/t5/image/serverpage/image-id/272585i174A30F7BE7E20DB/image-size/large?v=v2&px=999 "2023-08-01_16-43-20.png")

After sorting I still get 1,2,3

![2023-08-01_16-43-40.png](https://community.atlassian.com/t5/image/serverpage/image-id/272587i44F7B8D4D20C32A4/image-size/large?v=v2&px=999 "2023-08-01_16-43-40.png")

It is not surprising that this is not possible in Confluence but I was hoping that the Table Transformer could do this. It would have to recalculate the number value after every sort/filter in the nested table filter macro.

This is a super edge case that is probably not worth deep diving into. In my case, participants in the project planning meetings can just use the name of the projects. They are just kind of long and similar to each other so I was thinking some numbering could help. We also have jira #s so we can use that as well.


author: Stiltsoft support
body: Now I see that I got your case totally wrong - you need your numbers to be dynamic and not static. At first I got your question exactly like [@Sayed Bares \[ServiceRocket\]](/t5/user/viewprofilepage/user-id/1480984) did. :)

So, the Table Spreadsheet macro then works exactly as you need but as for now it doesn't recognize the Page Properties Report macro - this feature is on our roadmap and we'll get back here after the release and notify you.

What concerns the Table Filter macro, then it also works correct if you choose the dynamic row numbering type and use filtration and sorting within the macro.

If you use native sorting from the table header, then the numbers become static and move within the table as well.

So, you may set the default sorting once inside the Table Filter macro from the page edit mode and then only filter your table from the page view mode without using native Confluence sorting.


author: Alexey Mikhaylov _Stiltsoft_
body: Hello [@Joachim Martin](/t5/user/viewprofilepage/user-id/5276508) ,

Let me inform you we've released a new macro - [Spreadsheet from Table](https://docs.stiltsoft.com/tfac/cloud/how-to-use-spreadsheet-from-table-152142229.html?utm_source=atl_community&utm_medium=answer&utm_campaign=table-filter-traffic-sources%20&utm_vendorID=1216111) - which allows transferring your regular table or a table outputting a macro's content (such as, for example, Page Properties Report) into [Table Spreadsheet](https://docs.stiltsoft.com/tfac/cloud/how-to-use-table-spreadsheet-macro-83100938.html?utm_source=atl_community&utm_medium=answer&utm_campaign=table-filter-traffic-sources%20&utm_vendorID=1216111) with all its tools. This should help your use case.

P.S. If you don't see the macro available in your Confluence Cloud instance, please approach your Confluence admin and ask him to update Table Filter and Charts for Confluence manually from the administration settings.


Tags: cloud

confluence-cloud

filter

ms-excel

table