Randomly Changing cost code

gurubh

New Member
Joined
Dec 19, 2018
Messages
1
I have cost range as shown below C1 till C15. However, I want to a button which can change the Cost code randomly however amount range should be in same place.

For example, if C1 assigned to 0 to 3Lacs as below, it should change as C12(or any random) as 0 to 3 Lacs when I click that button. However random should be with the range from C1 to C15 and all the range should change accordingly and no repetitive of the cost code.

I mean, once I click on random button, upto 3 lacs becomes something from C2 to C15 and other range gets different. and it should keep changing the codes every time the button clicked.
C1 - 299,999
C2 300,000 499,999
C3 500,000 799,999
C4 800,000 999,999
C5 1,000,000 1,199,999
C6 1,200,000 1,499,999
C7 1,500,000 1,799,999
C8 1,800,000 1,999,999
C9 2,000,000 2,299,999
C10 2,300,000 2,599,999
C11 2,600,000 2,899,999
C12 2,900,000 3,199,999
C13 3,200,000 3,499,999
C14 3,500,000 3,799,999
C15 3,800,000 3,999,999

<colgroup><col><col span="2"></colgroup><tbody>
</tbody>
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
You could record these step to a macro.

In column D (or any empty column) put this formula for each row
=RANDBETWEEN(1,1000)
This will put a random number in that column.

Select columns C and D and Sort them based on column D.
You could clear column D after if you like.
 
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,380
Members
449,080
Latest member
Armadillos

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