+ Reply to Thread
Results 1 to 17 of 17

Find exact match in string array

  1. #1
    Registered User
    Join Date
    06-26-2015
    Location
    Poland
    MS-Off Ver
    365
    Posts
    60

    Find exact match in string array

    Hello,
    Please see attachment. I'm trying to find exact letters in array of strings (few k rows to check) and return code and name of the found record.
    So far, I've been trying to do it with this formula:
    Please Login or Register  to view this content.
    but when I'm looking for example for text: "7523M" in strings array I will get in return "3M STARTPAKET M 7523MF ERS?TTER 06782" and that is incorrect, I'm only interested specifically in 7523M not 7523MF.
    Text in strings array isn't always at the same spot, it can be at the end, middle or start, so it's random.
    How can I achieve that?
    Attached Files Attached Files
    Last edited by Pojzon; 03-09-2023 at 05:10 AM.

  2. #2
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2024
    Posts
    6,203

    Re: Find exact match in string array

    Try this

    =XLOOKUP("*"&[@[To find]]&" *";TbSearch[Name];TbSearch[Name];;2)

  3. #3
    Registered User
    Join Date
    06-26-2015
    Location
    Poland
    MS-Off Ver
    365
    Posts
    60

    Re: Find exact match in string array

    Thank you for help, but this solution doesn't seem to work with every case that I have. For example:
    Searching for 289A and there is text "3M ACETAT AUSTAUSCHSCHEIBEN 289A", but your formula shows error in this case or,
    searching for 972 and your formula returns "FESTO FILTERSACK FUER CT 44 452972 3M 202616" when it shouldn't.

  4. #4
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Cool Re: Find exact match in string array

    with Power Query

    is that what you want?

    To find Code Name
    INOX
    17
    * 046300 VIS INOX A2 4,8 X 38 (200P)
    750
    21
    * SEUIL DINAC 3M REF 207500
    5901NEW
    19
    **obsolete**4X48,5ML KUNSTSTOFF-REPARATURMATERIAL 05901NEW DOPPELKARTUSCHEN-SET
    26034
    10
    3M 26034 PPS SERIES 2.0 ADAPTER,TYPE S-4
    79
    20
    3M 734 SCHUURPAPIER 25ST P240 01979
    289A
    5
    3M ACETAT AUSTAUSCHSCHEIBEN 289A
    52025
    11
    3M CUBITRON II HOOKIT STREIFEN 737U 80X400MM 52025 P 400
    65170
    6
    3M CUBITRON II Kapskiva T41, 76mm x 1mm x 8mm, PN65170
    5535
    3
    3M FINISH-KONTROLSPRAY 55535
    2010
    18
    3M HIGH PERFORMANCE CLOTH BLUE 02010HLBU
    26811
    13
    3M HOCHLEISTUNGSDUESENKOPF HVLP 1,1 MM GELB 26811
    26814
    14
    3M HOCHLEISTUNGSDUESENKOPF HVLP 1,4 MM ORANGE 26814
    26818
    15
    3M HOCHLEISTUNGSDUESENKOPF HVLP 1,8 MM TRANSPARENT 26818
    34240
    9
    3M Plastlagningslim 50 ml, 6 st/fp, 34240A
    1639
    7
    3M PPS COLOR CORRECTIVE BULB 16399
    2890S
    4
    3M PREMIUM FULL VISION GLASSES 2890SA
    64698
    16
    3M SCOTCH BRITE VLIESBAND A CRS 13X457MM 64698
    7523L
    2
    3M STARTPAKET L A2/P3 (ers 06783) 7523LF
    7523M
    1
    3M STARTPAKET M 7523MF ERSÄTTER 06782
    8878
    12
    3M STEINSCHLAGSCHUTZ WEIS.8878
    972
    8
    FESTO FILTERSACK FUER CT 44 452972 3M 202616
    RET
    22
    LUNETTES SECURET FIT 400 GRISE VERSION SOLAIRE
    Last edited by sandy666; 03-08-2023 at 07:25 AM. Reason: update

  5. #5
    Registered User
    Join Date
    06-26-2015
    Location
    Poland
    MS-Off Ver
    365
    Posts
    60

    Re: Find exact match in string array

    Thank you for help, but not exactly. As you can see in your examples to find 750 returned name "* SEUIL DINAC 3M REF 207500". I want to see only exact matches, if this name would be "* SEUIL DINAC 3M REF 750" then that would be correct.
    I guess it needs to somehow look for spaces between words and if it's at the end or beginning of string. No idea if that is possible to do with excel?

  6. #6
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Cool Re: Find exact match in string array

    maybe

    To find Code Name
    INOX
    17
    * 046300 VIS INOX A2 4,8 X 38 (200P)
    26034
    10
    3M 26034 PPS SERIES 2.0 ADAPTER,TYPE S-4
    52025
    11
    3M CUBITRON II HOOKIT STREIFEN 737U 80X400MM 52025 P 400
    Last edited by sandy666; 03-08-2023 at 08:25 AM.

  7. #7
    Registered User
    Join Date
    06-26-2015
    Location
    Poland
    MS-Off Ver
    365
    Posts
    60

    Re: Find exact match in string array

    That is a start that looks promising. I've checked your PowerQuery steps and Text.contains should be also flagging cases like:
    Attachment 820756
    Right? Why isn't it?

  8. #8
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Find exact match in string array

    your attachment is inappropriate added

  9. #9
    Registered User
    Join Date
    06-26-2015
    Location
    Poland
    MS-Off Ver
    365
    Posts
    60

    Re: Find exact match in string array

    Oh sorry, perhaps now:
    Ok, I can see that you've tried adding spaces before and after the word to find, but as you can see that also skips correct records to find.
    Attached Images Attached Images

  10. #10
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Find exact match in string array

    I think I don't understand your logic in the picture
    could you detailed explain what you mean?

    edit:
    I didn't tried but I added spaces

    post example with proper expected result (excel file not a picture)
    Last edited by sandy666; 03-08-2023 at 09:11 AM.

  11. #11
    Registered User
    Join Date
    06-26-2015
    Location
    Poland
    MS-Off Ver
    365
    Posts
    60

    Re: Find exact match in string array

    Sorry, perhaps I've poorly explained it.
    In the first post, I've attached file with records highlighted in colors: red incorrectly matched, green correct.
    Your PowerQuery returned only 3 matches, while it should have 9 (well maybe 8 because of the search for 8878 while text "3M STEINSCHLAGSCHUTZ WEIS.8878" contains word WEIS.8878, this one might be tough to match since there is no space before number).
    What I need is to find exactly the same code from column "To find" in array of strings "Name" and then return corresponding "Code". It can't have any additional numbers or letters like 7523M shouldn't be returning record with 7523MF in it.
    I'm not sure if that's possible to do with excel, since that code to find can be at the beginning of string, in the middle or at an end, hard to predict all the cases, it's just mixed in somewhere in the text and I'm trying to find this exact word.

  12. #12
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Cool Re: Find exact match in string array

    see this

    To find Code Name
    INOX
    17
    * 046300 VIS INOX A2 4,8 X 38 (200P)
    26034
    10
    3M 26034 PPS SERIES 2 0 ADAPTER,TYPE S-4
    289A
    5
    3M ACETAT AUSTAUSCHSCHEIBEN 289A
    52025
    11
    3M CUBITRON II HOOKIT STREIFEN 737U 80X400MM 52025 P 400
    26811
    13
    3M HOCHLEISTUNGSDUESENKOPF HVLP 1,1 MM GELB 26811
    26814
    14
    3M HOCHLEISTUNGSDUESENKOPF HVLP 1,4 MM ORANGE 26814
    26818
    15
    3M HOCHLEISTUNGSDUESENKOPF HVLP 1,8 MM TRANSPARENT 26818
    64698
    16
    3M SCOTCH BRITE VLIESBAND A CRS 13X457MM 64698
    8878
    12
    3M STEINSCHLAGSCHUTZ WEIS 8878


    btw. your conditions are not correct because EXACT is EXACT not .26811 because GELB.26811 is the string which shouldn't be taken
    Last edited by sandy666; 03-08-2023 at 09:47 AM.

  13. #13
    Registered User
    Join Date
    06-02-2020
    Location
    Turkey
    MS-Off Ver
    365 TR - V.2309
    Posts
    97

    Re: Find exact match in string array

    Hi,
    as an alternative solution by formula
    if you have TEXTSPLIT function

    Formula - D2
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Images Attached Images
    Attached Files Attached Files

  14. #14
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Find exact match in string array

    Maybe

    array formula (followed by Ctrl-Shift-Enter)
    =VLOOKUP("* "&[@[To find]]&" *"," "&TbSearch[Name]&" ",1,FALSE)

    Ps. I'm use Excel 2016, so I didn't have XLOOKUP function.

    Regards.

    Note : it's need space as delimiter , so if you want to find ABC from ABC, or ABC. it won't.
    Attached Images Attached Images
    Last edited by menem; 03-08-2023 at 09:42 PM. Reason: add note

  15. #15
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Find exact match in string array

    As I was mention above, the formula may need to changed to


    =VLOOKUP("* "&[@[To find]]&" *"," "&SUBSTITUTE(TbSearch[Name],"."," . ")&" ",1,FALSE)

    Regards.
    Attached Images Attached Images

  16. #16
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Find exact match in string array

    Oh, I've made some mistake.
    the formula should be

    =INDEX(TbSearch[Name],MATCH("* "&[@[To find]]&" *"," "&SUBSTITUTE(TbSearch[Name],"."," . ")&" ",0))

    Regards.
    Attached Images Attached Images

  17. #17
    Registered User
    Join Date
    06-26-2015
    Location
    Poland
    MS-Off Ver
    365
    Posts
    60

    Re: Find exact match in string array

    Everything looks great! Thank you all very much for the help, you just made my life way easier.
    Problem 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. Replies: 4
    Last Post: 04-21-2020, 07:32 AM
  2. need formula or vba to find exact string through list and find exact correct string
    By johnlara in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-04-2016, 04:12 AM
  3. Replies: 4
    Last Post: 01-06-2015, 09:15 PM
  4. [SOLVED] Challenge to find exact text string match
    By bentod in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-16-2014, 12:01 PM
  5. VBA Find Partial String in String Array and Output the Found String Array Value
    By scherich in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-02-2014, 11:20 AM
  6. [SOLVED] Find Exact Match Text String Using Formula
    By sweetrevelation in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-12-2012, 10:53 AM
  7. Concatenate string and find match in array?
    By Lhadrepsak in forum Excel General
    Replies: 1
    Last Post: 10-11-2010, 08:54 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