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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

EXCEL function to associate

Status
Not open for further replies.

Perzechella

Technical User
Aug 27, 2003
5
GB
Help,
I have a workbook and I need to associate two colums.
Well..it is a bit more complicate.
I have one colum containing a text and the second one a number.I have to sort out (automatically)the top 5 of this numerical column and then associate this top 5 with the realtive text.
Is there anybody who could help me??

thanks a lot
 
Hi,

In excel there is a function that automatically sorts the columns. This works as follows:

- Select the 2 columns(1 range)
- In the menu: chose Data and then Sort.
- Now you can chose which column you want to sort and in what direction.
- The other columns will automatically be associated.

If you want it in code, you can first record a new macro.
Then follow the procedure above
then stop recording the macro
and than you can goto the code of this macro and use it...

Regards,
T.
 
Hi,

you can record a macro that makes the sort you want and after that trigger the exection of the macro with some event of the worksheet:

Worksheet_Calculate or Worksheet_Activate

hope this help

A
 
I know that this is the VBA forum, but I fígured that maybe you might also be interested in a way to do this without Macros:

Use the AutoFilter:

Select the entire column with the numers and then go to Data->Filter->AutoFilter. In the top cell of the column you will see a drop-down button. Click that and then select (Top 10...) from the list.

This will allow you to select the top (or bottom) Items (or %) from the values in the number column. You can set the number of Items (or %) you want to see.

I hope this helps!



Peace! [peace]

Mike

Never say Never!!!
Nothing is impossible!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top