VBA code or formula for ranking values and then copying text above it in rank order

Peakey123

Board Regular
Joined
Nov 17, 2016
Messages
65
VBA code or a formula for the following please:

I have the words "Li" "Ma" "Ar" "Sp" "Ms" Ch" in the columns C, D, E, F, G and H respectively. They are in row 61 of the excel sheet. I then have numbers underneath each for about 20 rows. I need a formula or VBA code that looks at each row starting at row 62 and ranks "Li" "Ma" "Ar" "Sp" "Ms" Ch" from highest value to lowest depending on the figure beneath it and rank them in columns K,L,M,N and O in the same row as the values.

Thanks for your help
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Could you provide a small data sample (3~5 rows) along with expected results?

M.
 
Upvote 0
Li Ma Ar Sp Ms Ch1st2nd3rd4th5th
343334302740ChLiArMaSp
373635332841ChLiMaArSp
403938333144etcetcetcetcetc
414041343447
444344353550

<tbody>
</tbody><colgroup><col span="4"><col><col span="4"><col><col span="3"></colgroup>
 
Upvote 0
Maybe this...


C
D
E
F
G
H
I
J
K
L
M
N
O
P
61
Li​
Ma​
Ar​
Sp​
Ms​
Ch​
1st​
2nd​
3rd​
4th​
5th​
6th​
62
34​
33​
34​
30​
27​
40​
Ch​
Li​
Ar​
Ma​
Sp​
Ms​
63
37​
36​
35​
33​
28​
41​
Ch​
Li​
Ma​
Ar​
Sp​
Ms​
64
40​
39​
38​
33​
31​
44​
Ch​
Li​
Ma​
Ar​
Sp​
Ms​
65
41​
40​
41​
34​
34​
47​
Ch​
Li​
Ar​
Ma​
Sp​
Ms​
66
44​
43​
44​
35​
35​
50​
Ch​
Li​
Ar​
Ma​
Sp​
Ms​

<tbody>
</tbody>


Array formula in K62 copied across till P62 and down
=INDEX($C$61:$H$61,MATCH(LARGE($C62:$H62-(COLUMN($C62:$H62)-COLUMN($C62)+1)/(10^5),COLUMNS($K62:K62)),$C62:$H62-(COLUMN($C62:$H62)-COLUMN($C62)+1)/(10^5),0))

confirmed with Ctrl+Shift+Enter, not just Enter

Hope this helps

M.
 
Upvote 0
hi M,

thanks for your help with this, unfortunately at the minute when I paste the above into the cell it just says #Value. Any help would be great thanks
 
Upvote 0
Sorry M,

I have the array working but currently it just returns Ch for everything, so:
Ch Ch Ch Ch Ch
Ch Ch Ch Ch Ch
etc
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,868
Members
449,053
Latest member
Mesh

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