Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

excel sort based on matching columns

Status
Not open for further replies.

yoshe

Technical User
Jan 12, 2007
36
US
Hi, this probably is relatively simple, but I can't figure it out. I have a spreadsheet with many columns that I need to sort based on a unique numeric 'keycode', but the sort has to be in the same order as the 'keycode' in another spreadsheet, which is neither ascending or descending. I have to keep them ordered exactly the same in the two spreadsheets. Is there a way to do this without extensive coding? Thanks for any assistance.
 



Hi,

Method 1: COPY the KeyCode column from the source to this sheet and use the KeyCode LOOKUP the other values in the row.

Method 2: Add a column to your source sheet that is a numeric sequence nbr. It could be as simple as =ROW(). In your sheet of concern, LOOKUP the Sequence nbr for the KeyCode. Sort on THIS NEW COLUMN.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Thanks, #2 helped me work it out. I hadn't thought of adding a new column that would mark the original order.
 



Actually, you don't even NEED the Seq Nbr column in the original sheet. Just use the MATCH function in a new column on your sheet to sort, and it will return the relative offset (row if you will).

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top