+ Reply to Thread
Results 1 to 12 of 12

Return True/False by searching a value in an array of string

  1. #1
    Registered User
    Join Date
    06-09-2013
    Location
    Hong Kong
    MS-Off Ver
    Excel 2016
    Posts
    16

    Question Return True/False by searching a value in an array of string

    Hi all, appreciate if anyone can help. Thank you.

    A;B;C A Yes
    D;E B Yes
    C Yes
    J D Yes
    K;L;M E Yes
    N;O;P;Q F No
    G No
    H No
    I No
    J Yes
    K Yes
    L Yes
    M Yes
    N Yes
    O Yes
    P Yes
    Q Yes
    R No
    S No
    T No
    U No
    V No


    A1:A6 - Array - Data Source
    F1:F22 - Key words (can be one character or a string, but I use one character as an example)
    G1:G22 - expected result (will display "Yes" if the key word is exist in any cells of the Array, otherwise, "No")

  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: Return True/False by searching a value in an array of string

    Try something like this:

    =IF(SUMPRODUCT(--ISNUMBER(SEARCH(D2,A$2:A$7))),"Yes","No")
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,714

    Re: Return True/False by searching a value in an array of string

    Try this in G1:

    =IF(COUNTIF(A$1:A$6,"*"&F1&"*")>0,"Yes","No")

    then copy down to G22.

    Hope this helps.

    Pete

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

    Re: Return True/False by searching a value in an array of string

    Hi,

    In G1 and copy down:

    =IF(SUMPRODUCT(--(ISNUMBER(SEARCH("|"&F1&"|","|"&SUBSTITUTE($A$1:$A$6,";","|")&"|"))))>0,"Yes","No")

    Regards
    Click * below if this answer helped

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

  5. #5
    Registered User
    Join Date
    06-09-2013
    Location
    Hong Kong
    MS-Off Ver
    Excel 2016
    Posts
    16

    Re: Return True/False by searching a value in an array of string

    wow ... Thanks all of you .. All are working fine on the example & my real situation. Thank you Thank you.

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,714

    Re: Return True/False by searching a value in an array of string

    Glad to hear it.

    Go for the shorter one - less characters to type !!

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

    Pete

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

    Re: Return True/False by searching a value in an array of string

    You're welcome. We appreciate the feedback!

  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: Return True/False by searching a value in an array of string

    I second (third?) that!

  9. #9
    Registered User
    Join Date
    06-09-2013
    Location
    Hong Kong
    MS-Off Ver
    Excel 2016
    Posts
    16

    Re: Return True/False by searching a value in an array of string

    Sorry .. I have one more question .. How about this? As VLOOKUP can return only right column's value. Thank you.

    1 A;B;C A 1
    2 D;E B 1
    C 1
    3 J D 2
    4 K;L;M E 2
    5 N;O;P;Q F
    G
    H
    I
    J 3
    K 4
    L 4
    M 4
    N 5
    O 5
    P 5
    Q 5
    R
    S
    T
    U
    V

  10. #10
    Registered User
    Join Date
    06-09-2013
    Location
    Hong Kong
    MS-Off Ver
    Excel 2016
    Posts
    16

    Re: Return True/False by searching a value in an array of string

    I made it ... =INDEX($A$1:$A$6,MATCH("*"&E1&"*",$B$1:$B$6,0),1) .. Thank you ...

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

    Re: Return True/False by searching a value in an array of string

    Can't tell which columns you're using this time, but perhaps (I'll use a simplfied search formula this time):

    =INDEX($A$1:$A$6,MATCH(TRUE,INDEX(ISNUMBER(SEARCH(F1,$B$1:$B$6)),,),0))

    Regards

  12. #12
    Registered User
    Join Date
    06-09-2013
    Location
    Hong Kong
    MS-Off Ver
    Excel 2016
    Posts
    16

    Re: Return True/False by searching a value in an array of string

    Thanks XOR LX, I made one which similar with yours. Anyway, Thanks a lot for your help.

+ 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: 9
    Last Post: 01-21-2013, 01:54 AM
  2. Return subsequent list based on true/false array
    By john. in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-22-2012, 02:23 PM
  3. Replies: 6
    Last Post: 10-06-2011, 12:32 AM
  4. Replies: 3
    Last Post: 03-12-2010, 02:57 PM
  5. [SOLVED] Function to return True/False if all are validated as True by ISNU
    By Tetsuya Oguma in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-15-2006, 06:30 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