+ Reply to Thread
Results 1 to 6 of 6

Find if column A string is a substring of column B items

  1. #1
    Registered User
    Join Date
    03-13-2021
    Location
    Japan
    MS-Off Ver
    365
    Posts
    15

    Find if column A string is a substring of column B items

    Hello All

    I am trying compare a & b.
    I want to compare column a items with column b items.

    But, I want a function which could check if column b item is contained in column a.
    For e.g.

    Column a. レタスコ  
    Column b. レタス

    Column a has レタス but also コ. But, column b has only レタス.
    So, now I want the column a to change to レタス, and コ should be omitted.

    Column a & b has different sized strings so i can`t use index functions.

    Is there a way we can compare each letter in column a with letter in column b.
    Last edited by 6StringJazzer; 03-28-2021 at 07:53 AM. Reason: better title

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

    Re: Find if column A string is a substring of column B items

    You cannot doexactly that with a formula... but see if this is close enough:


    =IF(A2="","",IF(ISNUMBER(SEARCH(B2,A2)),B2,"Not present"))
    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.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    03-13-2021
    Location
    Japan
    MS-Off Ver
    365
    Posts
    15

    Re: Find if column A string is a substring of column B items

    Thank you Glenn.

    This seems to be working but could you modify it a little.
    What if we want to compare items in column a to items in column b of the table.

    So, the function will check first item in column a with all the items in column b and return the result present or not present.
    Then, second item in column a and so on.

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

    Re: Find if column A string is a substring of column B items

    Maybe this (I've jumbled them up a bit):

    =IF(B2="","",IF(SUMPRODUCT(--NOT(ISERR(SEARCH(B2,$A$2:$A$10))))>0,B2,"Not present"))
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    03-13-2021
    Location
    Japan
    MS-Off Ver
    365
    Posts
    15

    Re: Find if column A string is a substring of column B items

    Thank you Glenn. This is perfect.

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

    Re: Find if column A string is a substring of column B items

    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

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

+ 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. Comparing strings not working
    By JeffLeites in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-07-2019, 07:46 PM
  2. Comparing strings value
    By bryvba in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-21-2016, 07:03 AM
  3. [SOLVED] partially comparing strings vba
    By joetinger in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-19-2012, 08:54 PM
  4. Comparing text strings
    By gmalpani in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 12-18-2011, 01:59 PM
  5. Comparing Strings
    By dadio25 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-30-2009, 11:13 AM
  6. [SOLVED] Comparing text strings in cells
    By Andy in forum Excel General
    Replies: 0
    Last Post: 12-07-2005, 12:20 PM
  7. Comparing slightly different strings
    By carg1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-29-2005, 07:55 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