VBA to Data Cleanse Records

tshumba

New Member
Joined
Sep 18, 2017
Messages
1
Hi

I have 2 data sets. One is a clean Data set with 2 columns, ID and Surname (e.g. 10101, Smith). The other data set is dirty. It'll have a string in one cell (e.g. "Smith James 10101" or "10101 Smith" or "Smith10101" or "10101Smith"). Quite a few possibilities.

Because of this, I obviously cannot do a straight vlookup. I need to check the clean data set (ID & Surname) to see if the free texted string received has both the Surname and ID in any order whereby the string might contain more than just the ID and Username (e.g. "Smith James 10101")

Thanks
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Welcome to Mr Excel

If the ID is always present in the second list, maybe doing a search by ID using wildcard characters. Something like


A
B
C
D
E
1
List1​
Result​
List2​
Value​
2
10101, Smith​
10​
Smith10101​
10​
3
10102,ABCDE​
14​
XYFGR xxxx 10103​
12​
4
10103,XYFGR​
12​
xxxx 10102 ABCDE​
14​

Formula in B2 copied down
=VLOOKUP("*"&LEFT(A2,SEARCH(",",A2)-1)&"*",D:E,2,0)

Hope this helps

M.
 
Upvote 0

Forum statistics

Threads
1,216,113
Messages
6,128,905
Members
449,478
Latest member
Davenil

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