Ranking positive and negative decimal numbers. Actual Inputs and Expected Outputs are shared for help.

srikk7772

New Member
Joined
Aug 29, 2014
Messages
4
Hi,

Please find four columns -> 1st and 3rd columns and positive and negative numbers, Input columns, and 2nd and 4th columns are the results I would like to achieve in ms excel with your help.

[TABLE="width: 320"]
<tbody>[TR]
[TD="class: xl65, width: 64, align: right"]0.0001[/TD]
[TD="width: 64, align: right"]6[/TD]
[TD="width: 64"][/TD]
[TD="class: xl65, width: 64, align: right"]-0.0001[/TD]
[TD="width: 64, align: right"]6[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"]0.0009[/TD]
[TD="align: right"]6[/TD]
[TD][/TD]
[TD="class: xl65, align: right"]-0.0009[/TD]
[TD="align: right"]6[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"]0.0010[/TD]
[TD="align: right"]5[/TD]
[TD][/TD]
[TD="class: xl65, align: right"]-0.0010[/TD]
[TD="align: right"]5[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"]0.0019[/TD]
[TD="align: right"]5[/TD]
[TD][/TD]
[TD="class: xl65, align: right"]-0.0019[/TD]
[TD="align: right"]5[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"]0.0020[/TD]
[TD="align: right"]4[/TD]
[TD][/TD]
[TD="class: xl65, align: right"]-0.0020[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"]0.0029[/TD]
[TD="align: right"]4[/TD]
[TD][/TD]
[TD="class: xl65, align: right"]-0.0029[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"]0.0030[/TD]
[TD="align: right"]3[/TD]
[TD][/TD]
[TD="class: xl65, align: right"]-0.0030[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"]0.0039[/TD]
[TD="align: right"]3[/TD]
[TD][/TD]
[TD="class: xl65, align: right"]-0.0039[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"]0.0040[/TD]
[TD="align: right"]2[/TD]
[TD][/TD]
[TD="class: xl65, align: right"]-0.0040[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"]0.0049[/TD]
[TD="align: right"]2[/TD]
[TD][/TD]
[TD="class: xl65, align: right"]-0.0049[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"]0.0050[/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD="class: xl65, align: right"]-0.0050[/TD]
[TD="align: right"]1[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Welcome to the board.

Assuming your table starts in A1, try this in B1 and copy down:

=CHOOSE(MATCH(ABS(A1)*1000,{0,1,2,3,4,5,6},1),6,5,4,3,2,1)

Then copy the formula into column D.
 
Upvote 0
Thanks for your quick reply. The expected output I have put in earlier was a sample.

The expected output I should not define in the formula, the output should be rather natural, understanding these rankings. One more set of test data contains (shared below for your help again) both negative and positive numbers, numbers may or may not repeat.

[TABLE="width: 64"]
<tbody>[TR]
[TD="width: 64, align: right"]0.3684[/TD]
[/TR]
[TR]
[TD="align: right"]0.386[/TD]
[/TR]
[TR]
[TD="align: right"]0.3274[/TD]
[/TR]
[TR]
[TD="align: right"]0.2385[/TD]
[/TR]
[TR]
[TD="align: right"]0.134[/TD]
[/TR]
[TR]
[TD="align: right"]0.1204[/TD]
[/TR]
[TR]
[TD="align: right"]0.1604[/TD]
[/TR]
[TR]
[TD="align: right"]0.1234[/TD]
[/TR]
[TR]
[TD="align: right"]0.152[/TD]
[/TR]
[TR]
[TD="align: right"]0.0989[/TD]
[/TR]
[TR]
[TD="align: right"]0.009[/TD]
[/TR]
[TR]
[TD="align: right"]0.0224[/TD]
[/TR]
[TR]
[TD="align: right"]-0.2396[/TD]
[/TR]
[TR]
[TD="align: right"]-0.281[/TD]
[/TR]
[TR]
[TD="align: right"]-0.2451[/TD]
[/TR]
[TR]
[TD="align: right"]-0.279[/TD]
[/TR]
[TR]
[TD="align: right"]-0.2875[/TD]
[/TR]
[TR]
[TD="align: right"]-0.2341[/TD]
[/TR]
[TR]
[TD="align: right"]-0.281[/TD]
[/TR]
[TR]
[TD="align: right"]-0.281[/TD]
[/TR]
[TR]
[TD="align: right"]-0.2611[/TD]
[/TR]
[TR]
[TD="align: right"]-0.1925[/TD]
[/TR]
[TR]
[TD="align: right"]-0.3056[/TD]
[/TR]
[TR]
[TD="align: right"]-0.5661[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:
Upvote 0
The original formula worked for thousandths. If they will be intermingled, this formula won't work. This will work for tenths. But again, it won't work if the data is intermingled (tenths, hundredths, thousandths together).

=CHOOSE(MATCH(ABS(A1)*10,{0,1,2,3,4,5,6},1),6,5,4,3,2,1)

What are your actual parameters for determining rank?
 
Last edited:
Upvote 0
Sorry i misunderstood your problem

Disregard my post

M.
 
Last edited:
Upvote 0
Could you, please, tell us the expected output using the data sample in post #3?

M.
 
Upvote 0
Few inputs that can share what I'm longing for..

-> Start of the negative series is -0.0001 and end of it can be, say -249.9999.
-> Start of the positive series is 0.0001 and end of it can be, say 249.9999.

In A1 and A2, please type -0.0001 and -0.0009, format these numbers using Format -> Numbers -> 4 digits. In A3 and A4, please type the formula =+A3+(-0.0001) and =+A4+(-0.0009) respectively. Select A3 and A4, drag them down say till row 100. You should now see a negative number series as shared in Post # 1.

-0.0001 and -0.0009 belongs to one family and can be given a rank of 10000.
-0.0010 and -0.0019 belongs to one family and can be given a rank of 10001 and rank should be assigned say till 19999.

Similarly, assign a rank of 20000 to 29999 for positive series.

Use these ranks (10000, 10001, 10002, 25786, 25787 and so on) in turn now on the test data posted in Post # 3 for the actual output.

If there is a quick and natural way to get this done in MS Excel, it would be great. In short, I'm basically looking for Steadiness in the data.

Please use 4 digits in the test numbers. Hope this helps. Eagerly waiting for help.
 
Upvote 0
Anybody there to help me on this please ? If this is directly not possible in MS Excel, probably you can help me through VBA code. I'm unfamiliar with VBA code, but I can quickly grasp it. Await your hand of help still :)
 
Upvote 0

Forum statistics

Threads
1,224,975
Messages
6,182,104
Members
453,088
Latest member
Chaoxite

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