Text - contains - IF

E

Excel Help

I have 5 strings and need to code each of them something based on
whetehr they contain certain words - example

Good Day 8am
Good Afternoon 3pm
Good Evening 6pm
Good Night 9pm

What I need is

if the string contains "Day" then call it " lght", if it contains
"Afternoon" call it "Bright", if it contains Evening call it "Twi" and
if it contains "Nght" call it "Drk"

Your help is much appreciated.
 
F

Frank Kabel

Hi
try
=IF(ISNUMBER(FIND("Day",A1)),"lght",IF(ISNUMBER("Afternoon",A1)),"Brigh
t",IF(ISNUMBER(FIND("Evening",A1)),"Twi",IF(ISNUMBER("Night",A1)),"Drk"
,"not defined"))))

Note this is case sensitive. If you don't need this replace FIND with
SEARCH
 
K

Ken Wright

Hi Frank - missed off a couple of FINDS in there (2nd and 4th) :)

=IF(ISNUMBER(FIND("Day",A1)),"lght",IF(ISNUMBER(FIND("Afternoon",A1)),"Bright",I
F(ISNUMBER(FIND("Evening",A1)),"Twi",IF(ISNUMBER(FIND("Night",A1)),"Drk","not
defined"))))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top