New Excel Forum

This forum has been moved to TeachExcel.com

Ask all future questions in the New Excel Forum.

ExcelKey

Sort ascending and return Row Reference for a range

Macros, VBA, Excel Automation, etc.

Sort ascending and return Row Reference for a range

Postby Radheesh » Sun Apr 10, 2016 4:32 pm

Hi,

This is my first post.

I am trying to create a dynamic table from a range of cells which need to be sorted in ascending order automatically and return the Row Reference number in the table.

Is there any formula or vba code that can do the task for me?

Thanks for the anticipated help,
  • 0

Radheesh
Rookie
 
Posts: 1
Joined: Apr 10, 2016
Reputation: 0
Excel Version: 2007

Re: Sort ascending and return Row Reference for a range

Postby Sisyphus » Tue Apr 12, 2016 12:20 am

Let's say, your list has the values{F, C, E, B, A, D}
Let's say, the currently selected value is B, the 4th value in the list.
Record the value B, not the row 4.
Now you sort the list and obtain {A, B, C, D, E, F}
In this list you look for B, which you find in row 2.
I suppose this could be done using formulas, but using VBA will be a lot easier.
  • 0

Have a great day! :D

Sisyphus
I do this for "honour and country" - much less of the latter, actually.
If I helped you, award points, plenty of them.
If I bored you, deduct points for being too long-winded. (I know, :lol)
Sisyphus
Former Moderator
 
Posts: 4454
Joined: Dec 7, 2011
Location: Shanghai
Reputation: 203
Excel Version: 2010


Return to Macros and VBA Questions

Who is online

Users browsing this forum: No registered users and 63 guests

cron