Rank within different segments

alizok

Board Regular
Joined
Sep 12, 2002
Messages
88
Office Version
  1. 365
Can someone help me on Ranking formula within different segments. for exaple i have 6 different segments that is in column A and than different numbers in column B i need to rank these numbers by segment. The segment are not sorted so it could be segment 1 in column A1 with number 32 in column B and then segment 5 in A2 with different number. Is there a way for me to rank nubers in colum B without sorting it by segment? Any suggestion is a great help.
thank you very much
 
Unfortunately I don't know how can I paste image on this board but what happens is that the formula with "small" doesn't work for all the numbers for some reason it doesn't work for rank 1 and 2 instead I get "#N/A" therefore all the rank are off by 2. Please see below simple paste. Your help is greatly appreciated

Code:
                  correct		
segmetnt	share	Rank	large	small
1	        62.80    3      3	     1
1	       68.20	    5      1	     3
1	       61.85	    2      4	   #N/A
1	       61.40	    1      5	   #N/A
1	       65.18	    4      2	    2
2	       57.30	    2      4	   #N/A
2	       61.05     3      3	     1
2	       56.57	    1      5	   #N/A
2	       67.94	    4      2	     2
2	       74.22	    5      1       3
3	       65.92     6      1	     4
3	       55.77	    2      5	   #N/A
3	       58.57	    4      3	     2
3	       63.89	    5      2	     3
3	       55.86	    3      4	     1
3	       54.30	    1      6	   #N/A
 
Upvote 0

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
alizok said:
Unfortunately I don't know how can I paste image on this board but what happens is that the formula with "small" doesn't work for all the numbers for some reason it doesn't work for rank 1 and 2 instead I get "#N/A" therefore all the rank are off by 2. Please see below simple paste. Your help is greatly appreciated

Code:
                  correct		
segmetnt	share	Rank	large	small
1	        62.80    3      3	     1
1	       68.20	    5      1	     3
1	       61.85	    2      4	   #N/A
1	       61.40	    1      5	   #N/A
1	       65.18	    4      2	    2
2	       57.30	    2      4	   #N/A
2	       61.05     3      3	     1
2	       56.57	    1      5	   #N/A
2	       67.94	    4      2	     2
2	       74.22	    5      1       3
3	       65.92     6      1	     4
3	       55.77	    2      5	   #N/A
3	       58.57	    4      3	     2
3	       63.89	    5      2	     3
3	       55.86	    3      4	     1
3	       54.30	    1      6	   #N/A

Is your data really sorted "segment"?
 
Upvote 0
no the data is not sorted by the segment. I just sorted it here so, that you can see the problem
 
Upvote 0
alizok said:
no the data is not sorted by the segment. I just sorted it here so, that you can see the problem

OK. Is it possible to sort your data on the Segment column? If the data is large, you could opt for sorting and settle for a fast working formula system.

By the way the formula Fairwinds suggested should work as advertised:
Book6
ABCDE
1segmetntshareRanklargesmall
2162.8333
3168.2515
4161.85242
5161.4151
6165.18424
7257.3242
8261.05333
9256.57151
10267.94424
11274.22515
12365.92616
13355.77252
14358.57434
15363.89525
16355.86343
17354.3161
Sheet1


D2:

=MATCH(B2,LARGE(($A$2:$A$100=A2)*$B$2:$B$100,ROW(INDIRECT("1:100"))),0)

E2:

=MATCH(B2,SMALL(IF($A$2:$A$100=A2,$B$2:$B$100,""),ROW(INDIRECT("1:100"))),0)

These formulas must be confirmed with control+shift+enter instead of just enter.
 
Upvote 0
I still have problem the samll formula doesn't work no matter how i do it sorte the segment or not I still get #N/A when it comes to rank 1 and 2 in each segment. I don't have a problem when it comes to Large formula it works both ways sorted segment and non sorted. :rolleyes: :oops:
 
Upvote 0
Post the formula as you have it in your sheet and describe exactly in wich cells your data is.
 
Upvote 0
={MATCH(B13,SMALL(IF($A$3:$A$279=A13,$B$3:$B$279," "),ROW(INDIRECT("3:279"))),0)} entered with ctrl+shift+enter

In column "A" i have different segments (not sorted) in column "B" i have points that need to be rank and in column "C" is where I'm entering the above mentioned formula.

:oops:
 
Upvote 0
The ROW(INDIRECT("3:279")) part should always start with 1, change to

ROW(INDIRECT("1:277"))
 
Upvote 0
Thank you very much i guess that was the problem.

would you please explain the function of row(indirect("1:100"))?

(y) (y)
 
Upvote 0
Glad we sorted it :biggrin:

It is a way of creating an array of 1 to 279 {1,2,3,4 etc...

Giving the {1,2,3,4... smallest values.
 
Upvote 0

Forum statistics

Threads
1,215,440
Messages
6,124,882
Members
449,193
Latest member
PurplePlop

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