+ Reply to Thread
Results 1 to 3 of 3

How do I search Strings and get an output?

  1. #1
    dziw
    Guest

    How do I search Strings and get an output?

    Using MS Excel 2003

    Hello,

    I have the following text in cells:

    A1: lobster and drink
    A2: steak and wine
    A3: bacon and eggs
    A4: dinner plate and water
    A5: lunch plater
    A6: sandwich and drink

    I want excel to look for certain words in these strings and "categorize" the string.
    So I'm trying to get excel to look at these strings, and if they contain the words: "lobster", or "steak" or "dinner" I want it to output the word "supper" in adjacent cell.

    If it contains "eggs" then the word "breakfast" should appear,

    And if there's the word "sandwich" or "lunch" the word "lunch" should appear

    therefore, after i run this script / use this formula i would get the following result

    A1: lobster and drink
    A2: steak and wine
    A3: bacon and eggs
    A4: dinner plate and water
    A5: lunch plater
    A6: sandwich and drink

    B1: supper
    B2: supper
    B3: breakfast
    B4: supper
    B5: lunch
    B6: lunch

    I'd really appreciate any help that anyone could provide!

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524
    try

    =If(Sum(CountIf(A1,{"*lobster*","*steak*","*dinner*"})),"Supper",If(CountIf(A1,"*egg*"),"Breakfast",If(Sum(CountIf(A1,{"*lunch*","*sandwich*"})),"Lunch","")))
    Last edited by jindon; 11-09-2007 at 03:57 AM.

  3. #3
    dziw
    Guest
    Quote Originally Posted by jindon
    try

    =If(Sum(CountIf(A1,{"*lobster*","*steak*","*dinner*"})),"Supper",If(CountIf(A1,"*egg*"),"Breakfast",If(Sum(CountIf(A1,{"*lunch*","*sandwich*"})),"Lunch","")))
    Thanks!! that worked perfectly! I really don't understand what is going on...but it works! hurray!

    Thanks again!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1