Match & Highlight pairs of data in 2 columns ignoring duplicates

Capt_Antihero

New Member
Joined
Jun 16, 2014
Messages
14
Hello,

I have a problem that I need some help with. I have data in 2 columns and I need to highlight all the amounts that match the list, looping down the list each item at a time, and once the amount is matched (paired) to continue the loop but disregard the paired (matched) items; even if the amount appears twice as it isn't a duplicate but 2 separate entries for the same amount. In the below table I've shown Amount A & Amount B:

Amount AAmount B
$400$200
$600$135
$200$150
$200$200
$135$400

<tbody>
</tbody>

I would need the macro start in Amount A ("Sheet1" L2) and search through the array of amounts from the start, in this case $400. It would have to find the first $400 listed in Amount B ("Sheet1" O2) Once it finds it's matching pair I would like both cells highlighted in yellow, and to do nothing i.e. leave it the colour it is if it doesn't find a match.

The macro would then proceed to find the next amount being $600 in Amount A and look through Amount B until the pair is found (from top to bottom of the list) Now for the tricky part, I need the macro to continue searching through each array for the amounts listed, and in the example above there is two $200, I need the macro to find the first $200 and / if found, then to still look for the second $200.

Everything I have researched like Instr that only finds the first instance or it would find $200 in $200.20 and call it a match. I've tried using vloopup methods but it only finds 1 match and ignores duplicates, although in my data it wouldn't be a duplicate, it's just two entries of the same amount. I've explained this as best I can I hope it makes sense, please help, I'm not new to VBA but this one has stumped me...
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,215,877
Messages
6,127,494
Members
449,385
Latest member
KMGLarson

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