Random sort only if cell has a value

ockie

New Member
Joined
Jan 11, 2020
Messages
36
Office Version
  1. 2013
Platform
  1. Windows
Hi,
I am trying to Random sort from column B but only if there is a value in column B. after the random sort from col B, data in the example below rows 9,11,15,16 will be under the last number in col B.
The sheet name is : template and on the sheet the columns in the sort range are B:L and the row range is 7:40.

this is for a sports club and if some is not going to attend I delete the number in col B, so I random sort only those who will be in attendance.


thanks in advance



A​
B​
C​
D​
E​
F​
G​
H​
I​
J​
K​
L​
7​
0.6459567​
21​
45​
AlanSmith=if(h7+"","",k7+j7)
8​
0.9768443​
14​
52​
GregJones
0​
9​
25​
41​
BruceBrown
0​
10​
0.0316331​
19​
47​
ColinWhite
0​
11​
26​
40​
TonyBlack
0​
12​
0.7737984​
29​
37​
RogerColt
0​
13​
0.9954291​
22​
44​
JoeCole
0​
14​
0.322505​
23​
43​
RonGeorge
0​
15​
19​
47​
MilesMichaels
0​
16​
18​
48​
LenWerth
0​
17​
0.1097377​
11​
55​
RickJohnston
0​
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Is the number in column B the result of a RAND() function? If so, why not simply sort the entire list on Col B Asc then Dec? This will give you exactly what you are looking for. If the value in column B is NOT generated from a RAND() function, then use a helper column in column M and insert the formula below and sort on column M.

Excel Formula:
=IF(C2<>"",RAND(),"")

Book1
ABCDEFGHIJKLMN
1ORIGINAL DATA
270.64595672145AlanSmith=IF(H7+"","",K7+J7)
380.97684431452GregJones0
492541BruceBrown0
5100.03163311947ColinWhite0
6112640TonyBlack0
7120.77379842937RogerColt0
8130.99542912244JoeCole0
9140.3225052343RonGeorge0
10151947MilesMichaels0
11161848LenWerth0
12170.10973771155RickJohnston0
13
14
15DATA WITH RAND() GENERATED NUMBERS IN COLUMN B
1670.64595672145AlanSmith=IF(H7+"","",K7+J7)
1780.97684431452GregJones0
1892541BruceBrown0
19100.03163311947ColinWhite0
20112640TonyBlack0
21120.77379842937RogerColt0
22130.99542912244JoeCole0
23140.3225052343RonGeorge0
24151947MilesMichaels0
25161848LenWerth0
26170.10973771155RickJohnston0
27
28DATA WITH RAND() GENERATED NUMBERS IN COLUMN B SORTED ASCENDING
29100.03163311947ColinWhite0
30170.10973771155RickJohnston0
31140.3225052343RonGeorge0
3270.64595672145AlanSmith=IF(H7+"","",K7+J7)
33120.77379842937RogerColt0
3480.97684431452GregJones0
35130.99542912244JoeCole0
36112640TonyBlack0
37151947MilesMichaels0
38161848LenWerth0
3992541BruceBrown0
40
41DATA WITH RAND() GENERATED NUMBERS IN COLUMN B SORTED DECENDING
42130.99542912244JoeCole0
4380.97684431452GregJones0
44120.77379842937RogerColt0
4570.64595672145AlanSmith=IF(H7+"","",K7+J7)
46140.3225052343RonGeorge0
47170.10973771155RickJohnston0
48100.03163311947ColinWhite0
4992541BruceBrown0
50161848LenWerth0
51151947MilesMichaels0
52112640TonyBlack0
Sheet1
 
Upvote 0
Solution
Is the number in column B the result of a RAND() function? If so, why not simply sort the entire list on Col B Asc then Dec? This will give you exactly what you are looking for. If the value in column B is NOT generated from a RAND() function, then use a helper column in column M and insert the formula below and sort on column M.

Excel Formula:
=IF(C2<>"",RAND(),"")

Book1
ABCDEFGHIJKLMN
1ORIGINAL DATA
270.64595672145AlanSmith=IF(H7+"","",K7+J7)
380.97684431452GregJones0
492541BruceBrown0
5100.03163311947ColinWhite0
6112640TonyBlack0
7120.77379842937RogerColt0
8130.99542912244JoeCole0
9140.3225052343RonGeorge0
10151947MilesMichaels0
11161848LenWerth0
12170.10973771155RickJohnston0
13
14
15DATA WITH RAND() GENERATED NUMBERS IN COLUMN B
1670.64595672145AlanSmith=IF(H7+"","",K7+J7)
1780.97684431452GregJones0
1892541BruceBrown0
19100.03163311947ColinWhite0
20112640TonyBlack0
21120.77379842937RogerColt0
22130.99542912244JoeCole0
23140.3225052343RonGeorge0
24151947MilesMichaels0
25161848LenWerth0
26170.10973771155RickJohnston0
27
28DATA WITH RAND() GENERATED NUMBERS IN COLUMN B SORTED ASCENDING
29100.03163311947ColinWhite0
30170.10973771155RickJohnston0
31140.3225052343RonGeorge0
3270.64595672145AlanSmith=IF(H7+"","",K7+J7)
33120.77379842937RogerColt0
3480.97684431452GregJones0
35130.99542912244JoeCole0
36112640TonyBlack0
37151947MilesMichaels0
38161848LenWerth0
3992541BruceBrown0
40
41DATA WITH RAND() GENERATED NUMBERS IN COLUMN B SORTED DECENDING
42130.99542912244JoeCole0
4380.97684431452GregJones0
44120.77379842937RogerColt0
4570.64595672145AlanSmith=IF(H7+"","",K7+J7)
46140.3225052343RonGeorge0
47170.10973771155RickJohnston0
48100.03163311947ColinWhite0
4992541BruceBrown0
50161848LenWerth0
51151947MilesMichaels0
52112640TonyBlack0
Sheet1


66
0.70665944​
2640CraigLawson0
66
0.714311304​
1947BrettConnelly0
66
0.453310556​
2244MitchSmith0
66
0.12439334​
2046GregTuchin0
66
0.870337551​
2343TonyGeraghty0
66
0.42094629​
660MickNey0
66
0.433084413​
2244BenFoster0
66
0.701829695​
2640PeterGormly0
66
0.029189249​
-1985JohnKearns0
66
0.422872325​
1749DavePratt0
66
0.748089569​
2145RobEardley0
66
0.044219276​
2937RonScott0
66
0.051547527​
2145RichardTaylor0
66
0.944398279​
2937SeanConnolly0
66
0.728972609​
2145RussellBrinkworth0
66
0.463699607​
2739RoryTayler0
661155RonJohnston0
661452IanGibson0
661848RossDearden0
661947GaryHoban0
662541GarryHughes0
663333CraigBradshaw0
 
Upvote 0
66
0.70665944​
2640CraigLawson0
66
0.714311304​
1947BrettConnelly0
66
0.453310556​
2244MitchSmith0
66
0.12439334​
2046GregTuchin0
66
0.870337551​
2343TonyGeraghty0
66
0.42094629​
660MickNey0
66
0.433084413​
2244BenFoster0
66
0.701829695​
2640PeterGormly0
66
0.029189249​
-1985JohnKearns0
66
0.422872325​
1749DavePratt0
66
0.748089569​
2145RobEardley0
66
0.044219276​
2937RonScott0
66
0.051547527​
2145RichardTaylor0
66
0.944398279​
2937SeanConnolly0
66
0.728972609​
2145RussellBrinkworth0
66
0.463699607​
2739RoryTayler0
661155RonJohnston0
661452IanGibson0
661848RossDearden0
661947GaryHoban0
662541GarryHughes0
663333CraigBradshaw0
Hi Crystalyzr,



 
Upvote 0
I don't understand what you are posting. do you have a question?
 
Upvote 0
Hi Crystalyzer, the last one did not make sense as I accidentally hit post reply.

I tried your method and it is the same as what I have been trying.
the above image is when I manually deleted the rand() number in col B for the names I did not want random sorted( the bottom 6), I would like the names at the bottom to be directly below with no lines in between.

I had a formula in col B =if(h7="","",rand()) this made the cells seem empty in col B , this works until i manually delete a figure in col B (for the people I do not wish to random sort.

also a formula in col L =if(h7="","",k7+j7), which is needed.

I thought there may be an easy way to random sort after cells were manually deleted.

thanks
 
Upvote 0
Hi Crystalyzer,
When i first tried the way you suggested I must have done it incorrectly.
I have just had another go at it, I took my time and followed exactly what you suggested, and it worked.

thank you for your help it is very much appreciated, especially for a novice such as myself.
 
Upvote 0

Forum statistics

Threads
1,215,436
Messages
6,124,869
Members
449,192
Latest member
MoonDancer

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