+ Reply to Thread
Results 1 to 6 of 6

If text contains different things

  1. #1
    Forum Contributor
    Join Date
    11-09-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    390

    If text contains different things

    Hi All,

    I used the following formula to say if H2 contains words diesel or petrol or fuel then return 'Equipment Fuel'. It does work for cells contain diesel but not for petrol and fuel. Does anyne know where I did it wrong?

    =IF(ISNUMBER(SEARCH({"Diesel","petrol","fuel"},H2)),"Equipment Fuel","")

    Thanks

  2. #2
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: If text contains different things

    =iferror(lookup(2,1/search($a$1:$a$3,c1),$b$1:$b$3),"")
    in a1:a3 are your words
    in B1;B3 - Equipment Fuel

  3. #3
    Forum Contributor
    Join Date
    11-09-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    390

    Re: If text contains different things

    Thanks but didn't work properly. Is there a way to modify the formula I got there?
    Quote Originally Posted by tim201110 View Post
    =iferror(lookup(2,1/search($a$1:$a$3,c1),$b$1:$b$3),"")
    in a1:a3 are your words
    in B1;B3 - Equipment Fuel

  4. #4
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: If text contains different things

    it does work
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor
    Join Date
    12-01-2016
    Location
    Planet Earth
    MS-Off Ver
    95 - 2016
    Posts
    343

    Re: If text contains different things

    Try this formula
    =IF(OR(H2={"Diesel","petrol","fuel"}),"Equipment Fuel","")

  6. #6
    Forum Contributor
    Join Date
    11-09-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    390

    Re: If text contains different things

    Thank you Tim, I see what you did there.

    Quote Originally Posted by tim201110 View Post
    it does work

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Macro to sort and insert text based on a cell's value, and other small things.
    By taylorsm in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 02-27-2017, 07:51 PM
  2. [SOLVED] Trying to do an IF Statement for 3 different things
    By Bosgarage57 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-04-2016, 02:21 PM
  3. Replies: 4
    Last Post: 06-07-2012, 10:11 AM
  4. Allowing text based on a few things
    By rxwillow in forum Excel General
    Replies: 8
    Last Post: 04-21-2008, 01:20 PM
  5. Need help with many things :D
    By Swoosh983 in forum Excel General
    Replies: 14
    Last Post: 02-13-2007, 05:30 PM
  6. two things at once?
    By evanzo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-29-2005, 09:15 AM
  7. Improrting Text file to a matrix when things are not constant.
    By underdrain in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-27-2005, 11:05 PM

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