Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
 
Posts: n/a
Default sort and return column numbers

I am a novice in Macro programming.

Can you please tell me how to sort numeric data in a row and return the
column numbers in the descending order of numbers

Ex-

A B C
15 10 14

i need to get the numbers 1,3,2 as the result.

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max
 
Posts: n/a
Default sort and return column numbers

One way

Source numbers assumed in A1:C1
(assuming no ties in the numbers)

Put in A2:
=MATCH(LARGE(1:1,COLUMN()),1:1,0)
Copy across to C2
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
" wrote:
I am a novice in Macro programming.

Can you please tell me how to sort numeric data in a row and return the
column numbers in the descending order of numbers

Ex-

A B C
15 10 14

i need to get the numbers 1,3,2 as the result.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Domenic
 
Posts: n/a
Default sort and return column numbers

In case of ties...

A5, copied across:

=MATCH(LARGE($A$1:$C$1-COLUMN($A$1:$C$1)/10^5,COLUMNS($A$5:B5)),$A$1:$C$1
-COLUMN($A$1:$C$1)/10^5,0)

....confirmed with CONTROL+SHIFT+ENTER.

Hope this helps!

In article .com,
wrote:

I am a novice in Macro programming.

Can you please tell me how to sort numeric data in a row and return the
column numbers in the descending order of numbers

Ex-

A B C
15 10 14

i need to get the numbers 1,3,2 as the result.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max
 
Posts: n/a
Default sort and return column numbers

"Domenic" wrote:
=MATCH(LARGE($A$1:$C$1-COLUMN($A$1:$C$1)/10^5,COLUMNS($A$5:B5)),$A$1:$C$1
-COLUMN($A$1:$C$1)/10^5,0)


Perhaps the part: COLUMNS($A$5:B5) in the array above
should be replaced by: COLUMNS($A$1:A1) <g ?
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max
 
Posts: n/a
Default sort and return column numbers

On reflection, perhaps just use RANK might suffice ..

With source numbers in A1:C1

Put in A2, copied to C2: =RANK(A1,$A$1:$C$1)

Ties in the source numbers, if any, will be given duplicate rankings,
with skipped subsequent rankings
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Domenic
 
Posts: n/a
Default sort and return column numbers

Thanks for catching my mistake, Max! I'm glad someone is paying
attention... <VBG

If entering the formula in A5, and copying it across, the formula should
be as follows...

=MATCH(LARGE($A$1:$C$1-COLUMN($A$1:$C$1)/10^5,COLUMNS($A$5:A5)),$A$1:$C$1
-COLUMN($A$1:$C$1)/10^5,0)

In article ,
Max wrote:

"Domenic" wrote:
=MATCH(LARGE($A$1:$C$1-COLUMN($A$1:$C$1)/10^5,COLUMNS($A$5:B5)),$A$1:$C$1
-COLUMN($A$1:$C$1)/10^5,0)


Perhaps the part: COLUMNS($A$5:B5) in the array above
should be replaced by: COLUMNS($A$1:A1) <g ?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert rows based on specific value bob Excel Worksheet Functions 6 February 29th 08 07:11 PM
Index? Match? Function to sort and return value fr diff column in Smurfette Excel Worksheet Functions 6 April 27th 06 05:46 PM
duplicate numbers in column a and diferent values in b Jeanne Excel Worksheet Functions 2 April 8th 06 07:23 PM
Return SEARCHED Column Number of Numeric Label and Value Sam via OfficeKB.com Excel Worksheet Functions 23 January 30th 06 06:16 PM
Excel ? Do Not Call Table Vindictiiv Excel Worksheet Functions 3 January 21st 06 01:05 AM


All times are GMT +1. The time now is 01:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"