Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: Look to see if a cell contains something

  1. #1
    New Member
    Join Date
    Apr 2002
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Is there any way for one cell to look to seee if another cell contains something with a long string of text. I want to make a conditional statement that does one thing if a cell contains the word "drop", however the word "drop" may be within a sentence that will be several words long. The sentence length will vary. Is there any way to ferret out a single word?

  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Austin, Texas USA
    Posts
    11,654
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    =IF(OR(ISNUMBER(MATCH({"drop","drop *","* drop *","* drop"},A1,0))),"does one thing","does another")

    [ This Message was edited by: Mark W. on 2002-04-22 06:20 ]

  3. #3
    New Member
    Join Date
    Apr 2002
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    =IF(OR(ISNUMBER(MATCH({"drop","drop *","* drop *","* drop"},A1,0))),"does one thing","does another")

    Worked fantastic, thanks a lot!!!

  4. #4
    Board Regular
    Join Date
    Feb 2002
    Location
    Ahmedabad Gujarat
    Posts
    303
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Write down this code in selection change event of the sheet.

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    If InStr(1, CStr(Target), "drop") Then
    ' code for conditional formating
    Target.Interior.ColorIndex = 35
    End If


    i hope this will work.

    ni****h desai
    http://www.pexcel.com

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •