Macro to compare two columns and keep row with matching data

VirtualInsanity

New Member
Joined
May 23, 2012
Messages
23
Office Version
  1. 365
Platform
  1. Windows
Hi team, I've been trying to find a macro code to compare two columns (column A with column C) and keep any rows of data that find a match i.e. if A3 matches C6 then the the entire 6th row will be kept (B6:AK6). Any help is appreciated!
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.

Using XL2BB could you give us a small set of dummy sample data "before" and "after"?

if A3 matches C6 then the the entire 6th row will be kept (B6:AK6)
.. and if A3 doesn't match with anything in column C what happens? This may well be answered by the sample requested above but please make sure it is clear what to do when there are matches and when there are not matches.
 
Upvote 0
Hi Peter, thanks for this. I've updated my profile. I'm using O365 on Windows, but I'm afraid I'm not allowed to install programmes on my work computer. I've uploaded an image of some dummy data though and an image of the desired result to give you an idea. Hopefully that's enough? If not I'll have to wait until I'm home and do it on my personal computer. I either want to delete the rows that don't come up with a match or simply create a new list with the matched data on a new spreadsheet within the workbook. I don't really mind which. I just need the rows that match the names in column A.
 

Attachments

  • Excel Dummy Data.jpg
    Excel Dummy Data.jpg
    105.1 KB · Views: 20
  • Excel Desired Result.jpg.png
    Excel Desired Result.jpg.png
    12.6 KB · Views: 15
Upvote 0
Unfortunately we can't copy from an image to test. But do you need a macro? Could you just use a formula like this?

VirtualInsanity.xlsm
ABCDEFGHIJKLMNOP
1AttendeeIDFull NameHdr4Hdr5Hdr6Hdr7IDFull NameHdr4Hdr5Hdr6Hdr7
2a1d793939533c27584416
3b2e771368185b448416
4c3c275844166a56239742
54s37242599
65b448416
76a56239742
87g4801973
9
10
Sheet1
Cell Formulas
RangeFormula
J2:O4J2=IFERROR(DROP(FILTER(Table1,ISNUMBER(MATCH(Table1[Full Name],Table1[Attendee],0))),,1),"")
Dynamic array formulas.
 
Upvote 0
You're welcome. Thanks for the follow-up. :)

.. and for updating your profile. (y)
 
Upvote 0

Forum statistics

Threads
1,223,958
Messages
6,175,636
Members
452,663
Latest member
MEMEH

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