Excel VBA to extract 2 or 3 keywords left and right from cell content

satish78

Board Regular
Joined
Aug 31, 2014
Messages
218
Hi Friends,


Trying to extract 2 or 3 keywords from cell content through excel vba.
Sheet1 ColumnA has rows with content sample file attached.
I need vba to search for keywords from sheet2 ColumnA in Sheet1 and extract 2 or 3 or 4 keywords from each row content into sheet3.(Popup box would be better to enter number of keywords to extrat each time when I run the macro)


sheet2 contacts keywords with space on right and left.
Please take a look in sample file attached.


https://spaces.hightail.com/space/f8TKHGTtPY


Satish
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Hello Satish,

What would the output on Sheet3 look like? You did not include examples in your workbook.
 
Upvote 0
Hello Satish,

Thanks for the updated workbook. I see that each column on Sheet3 is used for a single keyword match from Sheet2.

Do you want all matches for a particular keyword in row listed or only the first match found?

Extracting a single word from the left of the keyword and to the right of it is easy. Ignoring punctuation and articles like (a, an, the) is not difficult. However matches like "
Subject Matter Expert in logistics" become more difficult than simply "Expert in logistics". To handle matches like these would require an list of acceptable combinations of words used with "Expert" or their abbreviations like "SME in Logistics".
 
Upvote 0
I want all matches extracted.
Expert in logistics would be fine. Because the word Expert it self defines Expect in logistics.
 
Upvote 0

Forum statistics

Threads
1,214,590
Messages
6,120,423
Members
448,961
Latest member
nzskater

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