RANDBETWEEN with ascending order

khardu

Board Regular
Joined
Jan 18, 2012
Messages
68
Hello dear excel users,


how can I use RANDBETWEEN to list the result in an ascending order.







Thanking you.




Regards,




KHARDU
 
Yup, got it.
Thanks Biff, as well described by Aladin the formula does count the rows, just a way the get the 1st then 2nd then 3rd position ect (k).
Could have been ($A$1:A1) and it would have worked the same.
 
Upvote 0

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Could have been ($A$1:A1) and it would have worked the same.
Yes, that would evaluate the same. However, you should use the cell references where the formula(s) are being entered.

Let's assume you enter the formula in C2 and copy down but you use ROWS($A$1:A1) as the incrementer. If any of the cells in ROWS($A$1:A1) change then the formula(s) will recalculate. If you use ROWS(C$2:C2), those cells will only recalculate when other references in the bigger formula change.
 
Upvote 0
Thank you, yes it indeed makes sense. Cool alternative.

You are welcome.

Yup, got it.
Thanks Biff, as well described by Aladin the formula does count the rows, just a way the get the 1st then 2nd then 3rd position ect (k).
Could have been ($A$1:A1) and it would have worked the same.

ROWS($A$1:A1) or any other range with just 1 row in it or even ROWS($X$1:X7)-6 which yields 1 will all do. The good practice is to use the first cell in which the target formula is entered as anchor, making it easier to maintain. More importantly, this practice also prevents us choosing inadvertently a range whose cells would possibly contain volatile formula(s) like =NOW(). Although ROWS() itself appear to be non-volatle, referring to cells housing volatile formulas would cause the recalculation of our target formula (See Volatile Excel Functions -Decision Models for the latter point.).
 
Upvote 0
Noted Aladin.
I would have definitely thought ROWS and COLUMNS as being non-volatile. But correct me if I am wrong, regardless of the content of the cell, ROWS($A$1:A1) would return the row number right?
I mean to say if in A1 to A5 we have volatile formulas such as the ones described in the link you posted, the Row number would still return correctly... no?
This said, Yes using the first cell in which the target formula is entered as anchor, will definitely make it easier to maintain.

Thanks again, learned something new.
 
Upvote 0
Noted Aladin.
I would have definitely thought ROWS and COLUMNS as being non-volatile. But correct me if I am wrong, regardless of the content of the cell, ROWS($A$1:A1) would return the row number right?
I mean to say if in A1 to A5 we have volatile formulas such as the ones described in the link you posted, the Row number would still work... no?

Yes, it will still work.
This said, Yes using the first cell in which the target formula is entered as anchor, will definitely make it easier to maintain.

Thanks again, learned something new.

I have ever introduced and used

ROW()-ROW($C$2)+1

which is volatile because ROW() is volatile. ROWS($C$2:C2) is definitely better.
 
Upvote 0
Yes, it will still work.


I have ever introduced and used

ROW()-ROW($C$2)+1

which is volatile because ROW() is volatile. ROWS($C$2:C2) is definitely better.

I saw something similar to that in here: link.
It was in a Named range the formula was
=ROW(Sheet1!$D$2:$D$8)-ROW(Sheet1!$D$2)+1
So this was volatile, right?
 
Upvote 0
Thanks goes to Aladin.
As I said "the better solution..."
 
Upvote 0
I saw something similar to that in here: link.
It was in a Named range the formula was
=ROW(Sheet1!$D$2:$D$8)-ROW(Sheet1!$D$2)+1
So this was volatile, right?

Yes, it's. The difference is that this gives us an integer vector (multiple values) starting at 1, which evaluates to:

{1;2;3;4;5;6;7}

while ROW()-ROW($C$2)+1 (entered in C2) will yield a single item vector:

{1}

ROWS($C$2:C2) instead of ROW()-ROW($C$2)+1 would just yield:

1

which is a scalar value.

An integer vector like ROW(Sheet1!$D$2:$D$8)-ROW(Sheet1!$D$2)+1 is an important construct and is often used as bins in a FREQUENCY formula or in a formula that creates a condition-based sublists.
 
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