Changing values in column using macros

Dkeller12

Board Regular
Joined
Oct 7, 2011
Messages
60
I have a column of data that contains 100's of numbers from 1 to 5. When I sort these ascending, I basically have 111111222222333333444444555555 with each number in it's own cell. What I need, if possible, is a macro that searches this column and leaves the 1's alone, when it gets to the 2's it changes the first 2 it finds to a 1 and leaves the next 2 as a 2. Then when it hits the 3's, it changes the first 3 to a 1, the second 3 to a 2 and the next 3 stays a three. This continues through the column until I basically have the following: 111111121212123123

Or basically:

From 111111222222333333444444445555555555
To 111111121212123123123412341234512345

Hopefully there is a way to do this and would appreciate any help that I can get.

Thanks in advance!
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,215,888
Messages
6,127,590
Members
449,386
Latest member
owais87

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