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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
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,224,820
Messages
6,181,159
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