#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default IF Then HELP!!!!

Hi, I need help from someone who can help me write a formula that will look
in a cell (ex. A2) read the contents of the cell and if any of a certain type
of word is listed then print that word or just print the word check.

I have been trying something like this
Example cell A2 has ./....blue...yellow in the same cell. I want it to find
check for each color i list in the formula....ie...red, green, yellow, blue,
purple..etc. but only fill in the colors that do appear.

IF(ISNUMBER(SEARCH("red",A2)),"RD","CHECK")

the problem I have is getting it to check for the rest of the colors in the
same cell with this formula...Kind of an if this statement is true print "RD"
and look for the next color, if false then check for the next color....and
so. If anyone knows of a way to do this it would help me out a lot. Thank you
and be blessed for all of your help in this.

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 695
Default IF Then HELP!!!!

put in a regular module

Function myColor(myCell)
Dim c1
Application.Volatile
If InStr(1, myCell, "red") 0 Then c1 = "red"
If InStr(1, myCell, "blue") 0 Then c1 = "blue"
If InStr(1, myCell, "green") 0 Then c1 = "green"
If InStr(1, myCell, "black") 0 Then c1 = "black"
If InStr(1, myCell, "yellow") 0 Then c1 = "yellow"
'If InStr(1, myCell, "another color") 0 Then c1 = "another color"
'If InStr(1, myCell, "another color") 0 Then c1 = "another color"
'If InStr(1, myCell, "another color") 0 Then c1 = "another color"
'If InStr(1, myCell, "another color") 0 Then c1 = "another color"
If c1 = "" Then c1 = "No match"
myColor = c1
End Function

In ur sheet use it this way:

=mycolor(a1)
or
=mycolor(sheet1!a1)

"Nimrod" skrev:

Hi, I need help from someone who can help me write a formula that will look
in a cell (ex. A2) read the contents of the cell and if any of a certain type
of word is listed then print that word or just print the word check.

I have been trying something like this
Example cell A2 has ./....blue...yellow in the same cell. I want it to find
check for each color i list in the formula....ie...red, green, yellow, blue,
purple..etc. but only fill in the colors that do appear.

IF(ISNUMBER(SEARCH("red",A2)),"RD","CHECK")

the problem I have is getting it to check for the rest of the colors in the
same cell with this formula...Kind of an if this statement is true print "RD"
and look for the next color, if false then check for the next color....and
so. If anyone knows of a way to do this it would help me out a lot. Thank you
and be blessed for all of your help in this.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"