Automation

Gotchaman

New Member
Joined
Jul 15, 2011
Messages
25
I have an imported data looks like below. Two rows contain records with same ID, so I'm trying to move each person's name to F column and delete the second row. See the second example as after clean-up. There are more than 13000 rows of records so there's no way I'd do this manually. If anyone can help me create an automated job I'd appreciate it. Thank you.
Excel Workbook
ABCDE
1W000002711089705/5/20114022516/22/1961
2W0000027Abagin, Adrian
3W000003711089705/5/201138264/13/1985
4W0000037Abbassy,Heba
5W000004615773526/6/20112777555/22/1987
6W0000046Albalbisi, Zakiah
Before
Excel 2007
Excel Workbook
ABCDEF
1W000002711089705/5/20114022516/22/1961Abagin, Adrian
2W000003711089705/5/201138264/13/1985Abbassy,Heba
3W000004615773526/6/20112777555/22/1987Albalbisi, Zakiah
After
Excel 2007
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
If this format is consistent, then...

1) Select Column B (for the relevant range), and then ctrl-drag and drop it on column F to create a copy of the values in Column B.
2) Drag and drop that copy upwards by one row (not a copy - move it) - this will leave you with the first and every second row after that looking like you want, with the other rows containing the Key value and the related name.
3) Sort the whole range by Column B - the numeric values will move to the top or bottom (depending on whether you are sorting ascending or descending - it really doesn't matter) , with the alphabetic values going the other way - you want to keep the rows with numeric values.
4) Go to the top or bottom of the sorted range, select the rows with alphabetic entries in Column B, and delete them.
5) Re-sort the remaining list in whatever order is best suited for your task.
6) If you want to return to the order shown, before you perform the sort in step 3 add a sequence number to each record, and then run the step 5 sort on that sequence number.
 
Last edited:
Upvote 0
Welcome to the Board!

See if this does what you need:

<font face=Calibri><SPAN style="color:#00007F">Sub</SPAN> foo()<br>    <SPAN style="color:#00007F">Dim</SPAN> i <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN><br>        <SPAN style="color:#00007F">For</SPAN> i = Cells(Rows.Count, "A").End(xlUp).Row <SPAN style="color:#00007F">To</SPAN> 1 <SPAN style="color:#00007F">Step</SPAN> -1<br>            <SPAN style="color:#00007F">If</SPAN> <SPAN style="color:#00007F">Not</SPAN> IsNumeric(Cells(i, "B").Value) <SPAN style="color:#00007F">Then</SPAN><br>                Cells(i, "B").Cut Cells(i - 1, "F")<br>                Cells(i, "B").EntireRow.Delete<br>            <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br>        <SPAN style="color:#00007F">Next</SPAN> i<br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>

HTH,
 
Upvote 0
dcardno thanks your method seems the simplest.

Smitty, the scrip didn't do anything... It appeared running but nothing changed.
thanks for trying though.
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,712
Members
452,939
Latest member
WCrawford

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