Formula IF contains a certain word

James8761

Board Regular
Joined
Apr 24, 2012
Messages
156
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have a master document that goes form Cell A1:BG22458. i want to create a summary report with just 6 columns. 5 are a simple link, the other requires a formula.

In Sheet1 I have set my summary tab up. Sheet 2 is the master data. In Cells F1:F22458 all cells contain number of words and most including a colour.

I want to pick the colour up. it is either BLUE, RED, GREEN, BLACK, OR WHITE.

So in Sheet 1 cell C1 i want a formula that looks at Cell F1 of Sheet2 that says (If cell F1 contains the word BLUE OR RED OR GREEN OR BLACK OR WHITE, then return that colour, if none of these colours are in Cell F1 of sheet 2, then return "No Colour")

Greatful for any help!
James
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Hi there.

This formula will look for all the words as written
=IF(SUMPRODUCT(--ISNUMBER(SEARCH({"BLUE","RED","GREEN","BLACK","WHITE"},Sheet2!F1)))>0,"Colour","No Colour")

A couple of points. It does a simple match on the letters, so if your data contains, say blackboard or occurred, then it will match the red bit shown. If all the colours are in them middle of each cell, then adding a space before and after each colour name will work, but this will not pick up colours at the very beginning or very end of the cell. I've just realised that you asked for the colour name, give me a bit of time to work on that.
Regards
John
 
Last edited:
Upvote 0
Looks like:

=IFERROR(LOOKUP(9.99999999999999E+307,SEARCH({"BLUE","RED","GREEN","BLACK","WHITE"},Sheet2!F1),{"BLUE","RED","GREEN","BLACK","WHITE"}),"No colour")
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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