Macros to compare values in two columns and place the duplicates in third column .......

olutoyin

New Member
Joined
Jun 22, 2011
Messages
15
I need macro script that will compare values in column a with values in column b,if there are values that are in a but not in b, such values are copied into column c, if there are values in column b that are not in column a, such values are copied to column d and place the duplicates (values in column a that also appear in column b) are copied into column e.

The Code should run from row 2 on all the 5 columns to give allowance for the column titles which will be in the 1st row of each column.

I hope i can get macros that can be used for this. Please any prompt response will be appreciated.

Thanks
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Also,

If there were values in A and B but these values did not match would you want to ignore these?
 
Upvote 0
Thanks comfy, i have tried to use formulas but it was very slow not responding for about 30 minutes because the data on the 2 columns are very bulky.

I will really prefer macros.
Expecting replies.
 
Upvote 0
What would you return for row five?
Excel Workbook
ABCDE
2321321
3321321321321
4987987987
5321321321???
Sheet1
Excel 2007
 
Upvote 0
Values in column a on row 2 should not reappear in row 5 since they are the same. Values on each column should be distinct i.e the same values should not reappear in a particular column.

Ideally the value in row 5 column a should not reappear same applies to value in column b row 5.

I hope you understand.

Thanks for your assistance
 
Upvote 0
Ignore that the values are duplicated in the column, its for an example only.

Would row five have and entry in both column C and D?
 
Upvote 0
Once the conditions are met:

Values in column a but not in column b is placed in column c
values in column b but not in column a is placed in column d
values in column a that are duplicated in column b is placed in column e

results in column c,d and e should start from row 2
 
Upvote 0
Repeating your question does not help. I understand what it is that you require.
You've not answered my question.

your first two statements:

Values in column a but not in column b is placed in column c
values in column b but not in column a is placed in column d

Are the same.

If "a" doesn't equal "b" is the same as If "b" doesn't equal "a"

unless a or b are blanks.

So please answer my question about what you want to happen if both a and b are not blank and are not the same.

Thanks,
/Comfy
 
Upvote 0

Forum statistics

Threads
1,224,618
Messages
6,179,919
Members
452,949
Latest member
beartooth91

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