Share via

Retain Original Row Number

Anonymous
2014-08-28T16:24:26+00:00

I am trying to create a user-defined function for retaining the original row number for a table.

For example, I would like to do some sorting on a table and then use a column which has my UDF to restore the original order of the table.

As I add rows, I would like this UDF to continue to add row numbers to my table.

Is this possible? Thoughts?

Thanks

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2014-08-28T23:26:19+00:00

With your data in its preferred original sort order, add a new column at the right end. In the first cell put a 1 and then a 2 in the second cell. Select both and drag the fill handle (lower right corner of the selection) down to the extent of your data. This should provide a series of numbers from 1 to however many rows you have. After sorting and filtering, you can easily revert back to the original sort order by using the helper column's series of numbers to sort on.

Fill data automatically in worksheet cells

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

Answer accepted by question author

Anonymous
2014-08-28T17:57:08+00:00

Hi Nelson,

Perhaps add a helper order column, numbered 1 - n, and use this column as the sort criterion to restore the initial sequence.

===

Regards,

Norman

Was this answer helpful?

0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Anonymous
    2014-08-29T05:16:13+00:00

    Hi Nelson,

    Can you please elaborate? I am not quite sure what you mean by that...

    You have an excellent explanation, courtesy of Jeeped, and I would only add that the helper column may be hidden without any adverse effect and may still be used as the sort column to restore your desired data sequence.

    ===

    Regards,

    Norman

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2014-08-28T18:58:34+00:00

    Thanks Norman.

    Can you please elaborate? I am not quite sure what you mean by that...

    Hi Nelson,

    Perhaps add a helper order column, numbered 1 - n, and use this column as the sort criterion to restore the initial sequence.

    ===

    Regards,

    Norman

    Was this answer helpful?

    0 comments No comments