+ Reply to Thread
Results 1 to 14 of 14

IF statement containing certain word/pattern

  1. #1
    Registered User
    Join Date
    10-18-2012
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2007
    Posts
    56

    IF statement containing certain word/pattern

    Hi,

    I am trying to create an IF statement but am struggling to make it work properly.

    I have my column B which has a code - for example TD12345 or RE12345

    I am trying to make an IF statement for my column C to display a certain text depending on column B

    Specifically, I am trying to make it so that
    IF column B contains TD put OP in column C
    IF column B contains RE AC or MA put IP in column C
    IF column B contains ER put ER in column C

    I think it is the second criteria which is screwing up my formula where you have three scenarios that results in one thing. Can anyone help me? Thank you.

  2. #2
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: IF statement containing certain word/pattern

    Try this

    Please Login or Register  to view this content.
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  3. #3
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: IF statement containing certain word/pattern

    I didn't really have to do the last IF statement but now it will handle other letter combos you might have...HTH

  4. #4
    Registered User
    Join Date
    10-18-2012
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: IF statement containing certain word/pattern

    Hmm...nope something is still off:
    Attached Images Attached Images

  5. #5
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: IF statement containing certain word/pattern

    I'm sorry I didn't read the original post correctly....easy to fix....

    Please Login or Register  to view this content.

  6. #6
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: IF statement containing certain word/pattern

    I'm sorry, I didn't read the OP correctly and then the site dumped me out....weird....

    Please Login or Register  to view this content.
    this should work,,,,

  7. #7
    Registered User
    Join Date
    10-18-2012
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: IF statement containing certain word/pattern

    Hmm I am still getting an error...does the formula work when you put it in excel? Here are two sample codes to put in Column B:

    OP000068/13
    TD005417/13

  8. #8
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: IF statement containing certain word/pattern

    yes it does for the TD005417/13 but in your OP you didn't mention the one of them would be starting with OP....could you upload a small dataset without company confidential...something else is happening here....thanks

  9. #9
    Registered User
    Join Date
    10-18-2012
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: IF statement containing certain word/pattern

    Hi

    Sorry for the confusion. So each code would contain one of those scenarios (having one of OP, TD, ER, MA etc), not in combination.
    Attached Files Attached Files

  10. #10
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: IF statement containing certain word/pattern

    So what do you want displayed if the col B starts with "OP"....check out the attached file...
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    10-18-2012
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: IF statement containing certain word/pattern

    Hi,

    Those that start with OP can be labelled as N/A

  12. #12
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: IF statement containing certain word/pattern

    My code current sets them to "" but that can be changed....

  13. #13
    Registered User
    Join Date
    10-18-2012
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: IF statement containing certain word/pattern

    Thank you, it works!

  14. #14
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: IF statement containing certain word/pattern

    yeah!!!!.....crowd goes wild....glad I could help and thanks for the rep bump....

+ 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