Text - contains - IF

  • Thread starter Thread starter Excel Help
  • Start date Start date
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.
 
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
 
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"))))
 
Back
Top