+ Reply to Thread
Results 1 to 8 of 8

If cell contains a word from a specific array...

  1. #1
    Registered User
    Join Date
    08-13-2013
    Location
    netherlands
    MS-Off Ver
    Excel 2003
    Posts
    12

    If cell contains a word from a specific array...

    Hey guys,

    I'm having trouble with my excel sheet... and I have been stuck here for several hours!

    I have an excel sheet with in column A the names of major retailers + location. For example:

    A
    IKEA City A
    IKEA City B
    Target City A
    Target City C
    Walmart City D
    ....
    ....

    This list continues for quite a bit. What I want to achieve is to get a list of names in column B of the retailers WITHOUT the city name. I only need to do this to a certain amount of retailers. My first thought was to use an array there I first write down the conditions and what results I want if the conditions are met. For example:

    IKEA* IKEA
    Target* Target
    Walmart* Walmart

    This unfortunately did not end well

    Vlookup does not work, it works the other way round (while the condition of IKEA*=IKEA City A holds, IKEA City A=IKEA* does not). This holds the same for the Match function.

    Any clue how I can solve this?

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: If cell contains a word from a specific array...

    Hi,

    If you could upload a sample workbook with your expected results that would be very useful.

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: If cell contains a word from a specific array...

    So you need to extract the first word of your string? If so try

    =LEFT(A2,FIND(" ",A2)-1)
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  4. #4
    Registered User
    Join Date
    08-13-2013
    Location
    netherlands
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: If cell contains a word from a specific array...

    Book1.xlsx

    Sometimes I want more than the first word and instead want to change it to its abbreviation.

    I added the spreadsheet to this post. You can find in column A the names of the retailers plus some extra words.

    In column D you can find the words I want to find in column A and the result I want to get in column E.

    For example, I want in C5:C11 "carrefour" and C23:C26 "dreamland" etc.

  5. #5
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: If cell contains a word from a specific array...

    hi gogita, maybe something like this in row 2:
    =LOOKUP("zzz",CHOOSE({1,2},"",LOOKUP(2^15,SEARCH($D$1:$D$5,A2),$E$1:$E$5)))

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  6. #6
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: If cell contains a word from a specific array...

    Try this in C2 and copy down as required.

    =IFERROR(INDEX($E$1:$E$5,MATCH(TRUE,INDEX(ISNUMBER(SEARCH($D$1:$D$5,A2)),,),0)),A2)

    Regards

  7. #7
    Registered User
    Join Date
    08-13-2013
    Location
    netherlands
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: If cell contains a word from a specific array...

    It works!!!! I'm trying to understand it by disecting it, but I'm failing pretty badly :P

    Could you explain how INDEX(ISNUMBER(SEARCH($D$1:$D$5,A5)),,) works?

    Firstly: SEARCH($D$1:$D$5,A5)
    You used an array as search value. How did you make this work, because when I use an array as search text, I will only get value errors.

    INDEX(ISNUMBER(SEARCH($D$1:$D$5,A5)),,)
    You used ISNUMBER(SEARCH($D$1:$D$5,A5)) as an array for this index and no values for column and row... what the hell? xD Please teach me!
    Last edited by gogita; 09-20-2013 at 07:08 AM.

  8. #8
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: If cell contains a word from a specific array...

    Hi,

    In certain situations, INDEX may be used to coerce an array of values as its return, in which case, since no particular entry is being sought, the row and column parameters are omitted.

    Regards

+ 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: 3
    Last Post: 07-12-2013, 09:17 AM
  2. Replies: 13
    Last Post: 08-04-2011, 09:41 AM
  3. omit specific word in array
    By allgeef in forum Excel General
    Replies: 2
    Last Post: 03-18-2011, 11:38 PM
  4. Finding a specific word in a cell and executing an array
    By jgray152 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-10-2010, 07:49 PM
  5. [SOLVED] Link from a specific Cell in Excel to a specific para. in Word
    By CathyK in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-10-2006, 11:45 AM

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