VBA for complex match and mismatch

topi1

Active Member
Joined
Aug 6, 2014
Messages
252
Office Version
  1. 2010
Is it possible to have a VBA that can create match and cross match function? Thank you.

All matches are case insensitive.

There may be blank rows in sheet2 data, but they can be removed if absolutely necessary.

No gaps in the sheet3 data.

Look at column R cells below TITLE1 cell and above TITLE2 cell in "sheet2".
Ignore cells where the part of the string contains "shows", "show" or ":".
Ignore cells where the same row column Q cell value is NOT 5.

The cells in the column R which meet above conditions do the following.

Look in the columns B to Z in the "sheet3" where the headers in the row 1 match with one of the cells in the column P of sheet2.
See if the qualified cells in the column R of sheet2 match with any of the cells from rows 2-50 in the qualified columns in the sheet3. Partial match is fine - as long as column R string contains a text from qualified columns in sheet is considered a match.

If there is a match, then add row1 header of the matched column from sheet3 in the beginning of the column R cell in sheet2.

First match in the string is the match in case there are multiple matches.

Following is the example.

Book1
BCDE
1English:Marathi:Hindi:
2Star WarsPathareSholay
3SupermanDon
4
Sheet3


BEFORE:
Book1
PQR
1English:Movies
2Hindi:Theater
3English:
4TITLE1
55Everyone does not like Star Wars.
65Sholay has great reviews.
75Superman and Don are great movies.
8
9TITLE2
10Everyone does not like Star Wars.
11Sholay has great reviews.
12Superman and Don are great movies.
Sheet2


AFTER:
Book1
PQR
1English:Movies
2Hindi:Theater
3English:
4TITLE1
55English: Everyone does not like Star Wars.
65Hindi: Sholay has great reviews.
75English: Superman and Don are great movies.
8
9TITLE2
10Everyone does not like Star Wars.
11Sholay has great reviews.
12Superman and Don are great movies.
Sheet2
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
  • What is your spreadsheet for?
  • What are you trying to achieve?
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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