I have 2 Excel 2007 Worksheets.
Excel Worksheet 1 : (as below ) 3 Columns are important in Sheet 1
userid name email
100 sam sam@sam.com
200 pete pete@pete.com
300 Bum Bum@Bum.com
400 Harry Harry@Harry.com
Worksheet 2 : (as below) ( user_id column is empty for all )
userid name email
sam sam@sam.com
Harry Harry@Harry.com
pete pete@pete.com
Bum Bum@Bum.com
I need a function/forumla with a macro where i can fill the values for userid in sheet 2
where the sheet2 email = sheet1 email
which will result as following in worksheet 2
userid name email
100 sam sam@sam.com
400 Harry Harry@Harry.com
200 pete pete@pete.com
300 Bum Bum@Bum.com
I know SQL but the query takes a long long time on MySQL DB to get the result…
Anyways below is the SQL query i was using in the DB.
UPDATE `j_A`
SET user_id = ( SELECT j_B.id
FROM j_B
WHERE j_B.email = j_A.email)
WHERE EXISTS
( SELECT j_B.id
FROM j_B
WHERE j_B.email = j_A.email);
Need Macro/Function/formula to Replace the Values of one Excel Sheet if both Email(Column) value matches,, if anyone cud help me regarding this creating Macro/Formula/functin etc…since
dont have much knowldge of creating formulae in Excel Macros..
Thanks in advance.
As per your example, try:
It will probably be more efficient to update the SQL query.
To open the VBA editor press Alt-F11.
Here is a screenshot of the code in the VBA editor with the code sample, click the green play button to run the code:
Based on the additional info you may want to try this alternative procdure: