Sort value of contiguous columns in Increasing/Decreasing order

hsandeep

Well-known Member
Joined
Dec 6, 2008
Messages
1,226
Office Version
  1. 2010
Platform
  1. Windows
  2. Mobile
My input range is E6:J7. E7:J7 which generates numerical values EXCEPT 0 or “” (null). ALSO they are contiguous columns. E6:J6 contains headers
IF B3=1, M7:R7 should get values from E7:J7 in INCREASING order. ALSO M6:R6 headers should be ‘corresponding’.
IF B3=2, M7:R7 should get values from E7:J7 in DECREASING order. ALSO M6:R6 headers should be ‘corresponding’.

How to achieve this?
Thanks in advance.
Book2.xlsx
BCDEFGHIJKLMNOPQR
31
4
5
6AACCBBDDEEEABCABCBBEEEAACCDD
74455117720221120445577
8DDCCAAEEEBBABC
977554420112
Sheet1
 
There are two ranges: AQ7:AX7 contains numbers and AQ8:AX8 contains corresponding header.
Working with AQ7:AX7 to get ranking and its corresponding position, then its header.
For example, in my sample in #16:
55 is found twice in AQ7:AX7. Both are 2nd ranking. But it required 1st 55 is 2nd then 2nd 55 is 3rd ranking.
Using a tip to get difference: Try to make a very small difference amount between them.
1st 55 is in column(AR) (column index = 44) , 2nd 55 is in column(AW) (column index = 49)
Try to add "column Index *10^-2" into 55 to make them small difference
AR7 = 55 + column()*10^-2 = 55 + column()/100 = 55.44
AW7 = 55 + column()*10^-2 = 55 + column()/100 = 55.49
Using this algorhym, then this array statement:

establish an array of values where dupplicate amounts are differrent
={44.43,55.44,11.45,77.46,11.47,2.48,55.49,8.5} (testing by Highlight that statement in formula bar then hit F9 to see instantly)
Then using AGGREGATE (or small, large) to get the rank.
Fantastic & intelligently usage of micro mathematics..I understood use of 10^-2
Lastly why A7 & A8 in the 2 formulas?
If A7 or A8 has a value, will it change the formula's final results?
 
Upvote 0

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Its INDEX(range, index) construction
=INDEX($A8:$AX8,index)
If index = column(AQ7) = 43 then
=INDEX($A8:$AX8,43)= AQ8
 
Upvote 0
Its INDEX(range, index) construction
=INDEX($A8:$AX8,index)
If index = column(AQ7) = 43 then
=INDEX($A8:$AX8,43)= AQ8
Understood construction of the formula...it requires in depth vision of the scenarios vis a vis the final outcome that has to be achieved..Many thanks bebo021999
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,322
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top