Ranking Changes in Quantity (whether they are positive or negative)

ellison

Active Member
Joined
Aug 1, 2012
Messages
356
Office Version
  1. 365
Platform
  1. Windows
Hi, we are trying to rank changes in quantity.
Some of the differences may be positive and some may be negative (i.e. some of the qty's may go up, some may come down), but what we are interested in ranking is the actual difference (not whether it is +ve or -ve)
Some of the data contains blanks, which actually should be zero's (but that's on the next round of tidying up duties for me!)

Hopefully this makes it a little bit clearer....


excel-ranking-changes-in-qty-question.xlsx
ABCDEFG
1Qty-AQty-B+ve or -veDifferenceRankManual Notes (not needed) Regarding the "difference between A & B is…"
25050same05...is 0, so this will be the smallest difference
35positive54...is 5, which is the second smallest difference NB some of the figures are blank (and blanks represent a "0")
410050positive501...is "50" which is the largest, therefore ranked highest = Number 1
58545positive402...is "40" which is the 2nd largest, therefore rank = 2
63575negative-402is "still 40" (regardless of it is positive or negative) which is the equal 2nd largest, therefore rank = 2
73565negative-303Difference between A & B is "30" which is the equal 3rd largest, therefore rank = 3
Sheet1
Cell Formulas
RangeFormula
C2:C7C2=IF(D2>0,"positive",IF(D2<0,"negative","same"))
D2:D7D2=+A2-B2



Huge thanks for taking a look!






Huge thanks for
 
Thanks Peter, you helped me to question myself. OK, this is my final suggestion. I sometimes feel stupid when I don't come up with a simple solution like this on the first try :confused:
Excel Formula:
=RANK(D2,$D$2:$D$9,0)+COUNTIF($D$1:D1,D2)
1701347122877.png
 
Upvote 0

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Thanks Peter, you helped me to question myself. OK, this is my final suggestion. I sometimes feel stupid when I don't come up with a simple solution like this on the first try :confused:
Excel Formula:
=RANK(D2,$D$2:$D$9,0)+COUNTIF($D$1:D1,D2)
That does not rank the equal differences equally. Remember ..
Where the difference 40 occurs twice, they are both (rightly!) ranked number 2.

The accepted solution above ranks them like this

23 11 30.xlsm
DE
1DifferenceRank
205
354
4501
5402
6402
7303
8501
9501
Rank ABS (2)
Cell Formulas
RangeFormula
E2:E9E2=COUNT(UNIQUE(FILTER(D$2:D$9,D$2:D$9>D2,"")))+1
 
Upvote 0
Ohh, I was living in a complete different wold. Now I see.. Distrubute equally but continue to rank where it left. Oh sorry so much again :(
 
Upvote 0
Ohh, I was living in a complete different wold. Now I see.
💡:)

@ellison
I don't know if it is of interest to you but you can achieve the rank results without actually needing the 'Difference' column and without needing to copy the top formula down. This formula in cell C2 will spill the other results down the column.

23 11 30.xlsm
ABC
1Qty-AQty-BRank Difference
250505
354
4100501
585452
635752
735653
Rank ABS (3)
Cell Formulas
RangeFormula
C2:C7C2=LET(d,ABS(A2:A7-B2:B7),BYROW(d,LAMBDA(r,COUNT(UNIQUE(FILTER(d,d>r,"")))+1)))
Dynamic array formulas.
 
Upvote 0
Solution
Wow that really is great...........

I'll swap over the solution to the one above in case anybody else wants to make use of it too

Huge thanks
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,169
Members
453,021
Latest member
Justyna P

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