Formula IF contains a certain word

James8761

Board Regular
Joined
Apr 24, 2012
Messages
154
Office Version
  1. 2019
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

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)
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,215,833
Messages
6,127,156
Members
449,367
Latest member
w88mp

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