Sort data in rows and columns that is a mess

Sharid

Well-known Member
Joined
Apr 22, 2007
Messages
1,066
Office Version
  1. 2016
Platform
  1. Windows
I have a list of data, it come in a mess and it takes forever to sort out with filters. The data comes like this

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]%John[/TD]
[TD]ADD:1 My Address[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]#Jane[/TD]
[TD]1 My Address[/TD]
[/TR]
[TR]
[TD]15[/TD]
[TD]%bob%[/TD]
[TD]ADD: 1 My Address[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]#peter?[/TD]
[TD]ADD: 1 My Address[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]ADD: 11 My Address[/TD]
[TD]#Joe[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]#Jane[/TD]
[TD]ADDS: 11 My Address[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]peter[/TD]
[TD]#Steve[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]ADDS:10 My Address[/TD]
[TD]#Steve[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

I need it to Keep All the rows

With "10" then
the rows with 10 + "#"
and then rows with 10,# + "ADD" or "ADDS" in them

The code is to then clears all the other rows and deletes all the BLANK and duplicate rows


Finally, It also needs to sort the names in Column B and Address in Column C. So the end result will look like this

End Result

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]ADD:1 My Address[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]#Jane[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]#Jane[/TD]
[TD]ADD: 11 My Address[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]#Joe[/TD]
[TD]ADD: 11 My Address[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]#Steve[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]#Steve[/TD]
[TD]ADDS:10 My Address[/TD]
[/TR]
</tbody>[/TABLE]

The code has ignored row with 15 and 5 above as they did not have the number 10 in them even though they had "#" + "ADD"

Can anyone please help.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Forum statistics

Threads
1,225,741
Messages
6,186,763
Members
453,370
Latest member
juliewar

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