Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
Random Sorting
Can anyone help?
I have a sheet with the following data: Item, Price1, Price2, Price3, Price4, I want to sort the prices for each item randomly but not sorting the whole col together but sorting row for row eg. Item, Price3, Price2, Price4, Price1, Item, Price2, Price4, Price3, Price1, Item, Price1, Price2, Price3, Price4, And so on down the rows. I can sort the whole col. by using a rnd. number but that wont help as my prices are from low to high and I need them to be scattered but still relating to the correct items. Many thanks in advance, Des |
#2
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
Random Sorting
Hi,
pls run the enclosed macro on an empty sheet. (The macro is recorded 'cause i do not know the functions in english, you only need the resulting formulas in the sheet.) columns A to E show what you want, the rest is used for construction. The prices will be sorted on every change you make in the sheet. columns F to I show random numbers (random*random = very unlikely to get the same number twice (which would mean same rank)). columns J to M show the rank of the random numbers, columns O to R are your 4 prices. read help to rank(), rand(), offset() functions. regards arno Sub Makro1() Cells(7, 1).Select ActiveCell.FormulaR1C1 = "item" Range("F7").Select ActiveCell.FormulaR1C1 = "=RAND()*RAND()" Range("G7").Select ActiveCell.FormulaR1C1 = "=RAND()*RAND()" Range("H7").Select ActiveCell.FormulaR1C1 = "=RAND()*RAND()" Range("I7").Select ActiveCell.FormulaR1C1 = "=RAND()*RAND()" Range("J7").Select ActiveCell.FormulaR1C1 = "=RANK(RC[-4],R7C6:R7C9)" Range("K7").Select ActiveCell.FormulaR1C1 = "=RANK(RC[-4],R7C6:R7C9)" Range("L7").Select ActiveCell.FormulaR1C1 = "=RANK(RC[-4],R7C6:R7C9)" Range("L8").Select ActiveWindow.SmallScroll ToRight:=1 Range("M7").Select ActiveCell.FormulaR1C1 = "=RANK(RC[-4],R7C6:R7C9)" Range("M8").Select ActiveWindow.SmallScroll ToRight:=6 Range("O7").Select ActiveCell.FormulaR1C1 = "a" Range("P7").Select ActiveCell.FormulaR1C1 = "b" Range("Q7").Select ActiveCell.FormulaR1C1 = "c" Range("R7").Select ActiveCell.FormulaR1C1 = "d" Range("R8").Select ActiveWindow.LargeScroll ToRight:=-1 Range("B7").Select ActiveCell.FormulaR1C1 = "=OFFSET(RC14,0,RC[8],1,1)" Range("C7").Select ActiveCell.FormulaR1C1 = "=OFFSET(RC14,0,RC[8],1,1)" Range("D7").Select ActiveCell.FormulaR1C1 = "=OFFSET(RC14,0,RC[8],1,1)" Range("E7").Select ActiveCell.FormulaR1C1 = "=OFFSET(RC14,0,RC[8],1,1)" Range("E8").Select End Sub |
#3
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
Random Sorting
random*random
oops! pls use rand()^rand() instead |
#4
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
Random Sorting
Thank's guy's for the prompt replys,
I've solved my problem using sulprobil's function. Many thank's once again for your help. ------------------------------------------------------------------------ "Megaman" wrote in message ... Can anyone help? I have a sheet with the following data: Item, Price1, Price2, Price3, Price4, I want to sort the prices for each item randomly but not sorting the whole col together but sorting row for row eg. Item, Price3, Price2, Price4, Price1, Item, Price2, Price4, Price3, Price1, Item, Price1, Price2, Price3, Price4, And so on down the rows. I can sort the whole col. by using a rnd. number but that wont help as my prices are from low to high and I need them to be scattered but still relating to the correct items. Many thanks in advance, Des |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Random sorting with restrictions | Excel Worksheet Functions | |||
Sorting random Data created from a random formula | Excel Discussion (Misc queries) | |||
Random sorting of list | Excel Discussion (Misc queries) | |||
Non-random numbers generated by excel's data analysis random gener | Excel Worksheet Functions | |||
Excel random sorting query | Excel Programming |