search for multiple keywords in a cell and return positive resuly when ALL are present

dori2o

Board Regular
Joined
Apr 7, 2016
Messages
72
I'm creating a quiz sheet in excel where the user inputs their answer into a cell. (i.e Cell F5)

The idea is that if they enter their answer into the answer cell the cell in the next column of that row will show a 'Tick' (uppercase P in windings font) if the answer is corect. At all other times the cell shows a 'cross' (uppercase O in windings).

Once all questions have been answered and all are correct they can submit the worksheet to an email address for the sheets to be verified and a winner chosen at random.

In order to get the tick in the cell the answer must contain certain keywords that are essential to the answer. i.e. the answer cannot be correct without these keywords.

I'm using =IF(SUMPRODUCT(--ISNUMBER(SEARCH(Y18:Y20,F5))),"P","O") to check for keywords in cell F5.

However, currently the formula returns a positive result even if there is only 1 word from the keywords list (held in range Y18:Y20) within the answer.

How would I update the formula so that all of the words in the list have to present within the text string before a positive result is returned.

Also can anyone confirm that having blank cells in the keywords list will have no effect on the answer, and if so how would I rectify this?

Many Thanks in advance.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Very nice Aladin !
I think that might depend on what the OP meant by this line from his original post... "In order to get the tick in the cell the answer must contain certain keywords that are essential to the answer". Are the test takers writing sentences or just listing words (sounds like sentences to me). If sentences, the formula will fail if a keyword appears at the end of a sentence because of the period adjacent to it. If a list, the test taker must resist their instinct for using commas or other list separator characters to separate the listed words from each other. I think we may need the OP to come back to this thread and clarify how his quiz is supposed to work.
 
Upvote 0
[SOLVED] Re: search for multiple keywords in a cell and return positive resuly when ALL are present

I think that might depend on what the OP meant by this line from his original post... "In order to get the tick in the cell the answer must contain certain keywords that are essential to the answer". Are the test takers writing sentences or just listing words (sounds like sentences to me). If sentences, the formula will fail if a keyword appears at the end of a sentence because of the period adjacent to it. If a list, the test taker must resist their instinct for using commas or other list separator characters to separate the listed words from each other. I think we may need the OP to come back to this thread and clarify how his quiz is supposed to work.

Hi,

Thanks to everyone for their input.

This has now been solved using the User Defined Function.

To answer your question in the last comment.

The answer boxes will either contain sentences OR a single URL.

The UDF provides me the opportunity to apply all necessary keywords and URL's int he keyword range.

Thank you all very much.
 
Last edited:
Upvote 0
Re: [SOLVED] Re: search for multiple keywords in a cell and return positive resuly when ALL are present

Hi,

Thanks to everyone for their input.

This has now been solved using the User Defined Function.

To answer your question in the last comment.

The answer boxes will either contain sentences OR a single URL.

The UDF provides me the opportunity to apply all necessary keywords and URL's int he keyword range.

Thank you all very much.

Post #10 does all that too, unless space as separator does not hold.
 
Upvote 0
Re: [SOLVED] Re: search for multiple keywords in a cell and return positive resuly when ALL are present

The answer boxes will either contain sentences OR a single URL.
Post #10 does all that too, unless space as separator does not hold.
What about the keyword next to the punctuation (period, question mark, exclamation mark) at the end of a sentence problem? And if it is a sentence, one might expect internal commas, hyphens and the such which, if next to a keyword, would also be a problem.
 
Upvote 0

Forum statistics

Threads
1,223,898
Messages
6,175,274
Members
452,628
Latest member
dd2

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