+ Reply to Thread
Results 1 to 9 of 9

Returning multiple values dependent on text found using IF and SEARCH Functions

  1. #1
    Registered User
    Join Date
    04-21-2014
    Location
    Ohio
    MS-Off Ver
    Excel 2010
    Posts
    3

    Returning multiple values dependent on text found using IF and SEARCH Functions

    Hello,

    I am using the formula below to search for text within a cell and return a specific value.

    For example, if the text within a cell contains "1 lb bag" the value returned will be "lb". Is it possible to add more arguments and return different values based on what it finds? For example, if the cell contains "10 oz" it will return a value of "oz" instead of "lb"?

    =IF(ISNUMBER(SEARCH("lb",J22)),"lb","")

    Thank you in advance.

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Returning multiple values dependent on text found using IF and SEARCH Functions

    How many search words do you have?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Returning multiple values dependent on text found using IF and SEARCH Functions

    One way:

    With a list of key words in E2 to E6, and data beginning in A2:

    =IFERROR(LOOKUP(10^10,SEARCH(E$2:E$6,A2),E$2:E$6),"")
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  4. #4
    Registered User
    Join Date
    04-21-2014
    Location
    Ohio
    MS-Off Ver
    Excel 2010
    Posts
    3
    Quote Originally Posted by Tony Valko View Post
    How many search words do you have?
    Currently four, but could possibly have one or two more in later iterations.

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Returning multiple values dependent on text found using IF and SEARCH Functions

    Quote Originally Posted by jujub33ns View Post
    Currently four, but could possibly have one or two more in later iterations.
    Glenn's suggestion should do what you want.

  6. #6
    Registered User
    Join Date
    04-21-2014
    Location
    Ohio
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Returning multiple values dependent on text found using IF and SEARCH Functions

    Fantastic - this works great. Thank you!

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft® Excel® for Microsoft 365 MSO (Version 2509 Build 16.0.19231.20138) 64-bit
    Posts
    31,957

    Re: Returning multiple values dependent on text found using IF and SEARCH Functions

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Returning multiple values dependent on text found using IF and SEARCH Functions

    Quote Originally Posted by Tony Valko View Post
    Glenn's suggestion should do what you want.
    But, of course, it had been your suggestion in a previous post!!

    “Imitation is the sincerest form of flattery that mediocrity can pay to greatness.”

    Oscar Wilde...

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Returning multiple values dependent on text found using IF and SEARCH Functions






    '''''''''''''''

+ 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. Replies: 2
    Last Post: 09-12-2015, 11:02 AM
  2. Replies: 5
    Last Post: 09-01-2014, 08:05 AM
  3. Replies: 3
    Last Post: 03-31-2014, 01:00 PM
  4. Search cell for multiple text , return comma separated text in separate cell if found
    By dangerdoug in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-01-2013, 01:52 PM
  5. Replies: 4
    Last Post: 10-06-2012, 08:25 AM
  6. sub string search returning multiple values
    By AackwardsBassLogic in forum Excel General
    Replies: 2
    Last Post: 05-23-2012, 10:04 PM
  7. Replies: 2
    Last Post: 11-24-2010, 05:44 PM

Tags for this Thread

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