Categorizing long answers based on certain keywords using Macro (with Function)

nanonano

New Member
Joined
Apr 14, 2022
Messages
2
Office Version
  1. 2013
Hello everyone, I hope you all have a good day.

I have this painstaking task that requires me to create a program to read a long list of columns (1000+ columns or so) of survey answers and assign each row to a category by finding keywords within the text in each cell using Macro VBA, and I'm losing my mind over it. My manager wants me to use Function so that it won't depend on a Button, but I still don't get the hang of it and confused as to how I should do it.

So, there would be a lot of categories, and for each kind of survey, the categories would differ, hence why each time the program is used, the categories should be set first if there isn't any specific category the users want. For each category too I would create a bank in another sheet to store the keywords so that the VBA could look up from the bank and assign the category to the main sheet. The macro I want should be able to read automatically each time a new category is added or when a keyword is added in each category in the bank...

The tricky thing is, the Macro should also be able to define more than one category result; up to three results, specifically, since there would sometimes be a really long answer that could consist of several lines with different key points. For example, "Providing flexibility in working hours as well as working space is important to me especially when we are still in this pandemic, the supporting facilities I get from the office is great, but the workload I have is too heavy for only myself to handle." The categories that appear would be "Flexibility", "Facilities Support" and "Workload/Work-life balance". In case of answers that only have one or two results, the column should just be left as "Not Specified".

And so, the two main problems are: how can I make the categories be dynamic and not hard-coded in the VBA so that whenever the survey changes, I can make a new category not present previously and the VBA would be able to read the category + keywords stored there, and in case of long answers with many key points, how do the VBA show the results in three separate columns?

I've attached the image and I'd really, really, really appreciate any help anyone could give. I've been brewing on this problem for two weeks already and am diagnosed with severe insomnia, and hopefully from here I can learn the way codes work and start making my own in the future.

Thank you so, so much for taking time to read this. May all of you stay safe amidst the ongoing pandemic and stay healthy!
 

Attachments

  • Bank Sheet.png
    Bank Sheet.png
    171.6 KB · Views: 11
  • Input Sheet.png
    Input Sheet.png
    197.4 KB · Views: 11

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Categorizing long answers based on certain keywords using Macro (with Function)
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0
Hi, Fluff. I'm sorry that I was negligent and didn't read the rules first. I'll make sure to remember that the next time I post here.

Thank you, I hope you have a nice day
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,728
Members
448,987
Latest member
marion_davis

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