How do I match a partial string in cell against a list Excel 2013?How do I clear cells with list data...

What can I do if I am asked to learn different programming languages very frequently?

When is the exact date for EOL of Ubuntu 14.04 LTS?

Is there any common country to visit for persons holding UK and Schengen visas?

Highest stage count that are used one right after the other?

Why is indicated airspeed rather than ground speed used during the takeoff roll?

Started in 1987 vs. Starting in 1987

Is divisi notation needed for brass or woodwind in an orchestra?

Reasons for having MCU pin-states default to pull-up/down out of reset

Why is "la Gestapo" feminine?

What properties make a magic weapon befit a Rogue more than a DEX-based Fighter?

Extract substring according to regexp with sed or grep

Should a narrator ever describe things based on a character's view instead of facts?

Weird lines in Microsoft Word

Why didn't Voldemort know what Grindelwald looked like?

Using an older 200A breaker panel on a 60A feeder circuit from house?

Are hand made posters acceptable in Academia?

Why does a 97 / 92 key piano exist by Bosendorfer?

Checking @@ROWCOUNT failing

Put the phone down / Put down the phone

Can you take a "free object interaction" while incapacitated?

What do the positive and negative (+/-) transmit and receive pins mean on Ethernet cables?

What is the meaning of "You've never met a graph you didn't like?"

Asserting that Atheism and Theism are both faith based positions

Taking the numerator and the denominator



How do I match a partial string in cell against a list Excel 2013?


How do I clear cells with list data validation based on another column's value?Find Substring Within Column - Excelsumming values that match text criteraFind largest number in one list and smallest number in another list to index one cellExcel Combo Box — how to validate input (not data validation list)How to ask excel to do sequenced formulas in single cellComparing 1 cell to 3 other cells in ExcelExcel - How to return different match values with other formulas?Organizing data in excel after breaking it up with text-to-columnHow do I count rows that contain cells with only the first few letters matching













1















I have the following information in a cell



| John Smith 34, Manager  | 
| Jane Doe 25, Assistant |
| Lucio 32, Web Developer |


I also have another list with a list of names



| Lucio            |
| John Smith |
| Jane Doe |
| Samuel L Jackson |


[edited to clarify the question]



What I want to do is parse the data in the first set of cells, comparing the names with the information in the second set of cells and out out put a 1 if they match.



How would I do this in excel 2013?



EDIT: I think many of the answers have, due to my mistake, misunderstood that lists need to match cell by cell. I just need to make sure the names in the first list are correct and that they match at least one in the second list.










share|improve this question
















bumped to the homepage by Community 7 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.




















    1















    I have the following information in a cell



    | John Smith 34, Manager  | 
    | Jane Doe 25, Assistant |
    | Lucio 32, Web Developer |


    I also have another list with a list of names



    | Lucio            |
    | John Smith |
    | Jane Doe |
    | Samuel L Jackson |


    [edited to clarify the question]



    What I want to do is parse the data in the first set of cells, comparing the names with the information in the second set of cells and out out put a 1 if they match.



    How would I do this in excel 2013?



    EDIT: I think many of the answers have, due to my mistake, misunderstood that lists need to match cell by cell. I just need to make sure the names in the first list are correct and that they match at least one in the second list.










    share|improve this question
















    bumped to the homepage by Community 7 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      1












      1








      1








      I have the following information in a cell



      | John Smith 34, Manager  | 
      | Jane Doe 25, Assistant |
      | Lucio 32, Web Developer |


      I also have another list with a list of names



      | Lucio            |
      | John Smith |
      | Jane Doe |
      | Samuel L Jackson |


      [edited to clarify the question]



      What I want to do is parse the data in the first set of cells, comparing the names with the information in the second set of cells and out out put a 1 if they match.



      How would I do this in excel 2013?



      EDIT: I think many of the answers have, due to my mistake, misunderstood that lists need to match cell by cell. I just need to make sure the names in the first list are correct and that they match at least one in the second list.










      share|improve this question
















      I have the following information in a cell



      | John Smith 34, Manager  | 
      | Jane Doe 25, Assistant |
      | Lucio 32, Web Developer |


      I also have another list with a list of names



      | Lucio            |
      | John Smith |
      | Jane Doe |
      | Samuel L Jackson |


      [edited to clarify the question]



      What I want to do is parse the data in the first set of cells, comparing the names with the information in the second set of cells and out out put a 1 if they match.



      How would I do this in excel 2013?



      EDIT: I think many of the answers have, due to my mistake, misunderstood that lists need to match cell by cell. I just need to make sure the names in the first list are correct and that they match at least one in the second list.







      microsoft-excel






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 16 '16 at 2:05







      Aasim Azam

















      asked Feb 14 '16 at 22:07









      Aasim AzamAasim Azam

      2546822




      2546822





      bumped to the homepage by Community 7 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 7 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          4 Answers
          4






          active

          oldest

          votes


















          0














          From what you describe, the easiest way to do what you're asking for would be to write a VBA macro as the formula. But your question is too vague. For example you need to say if the first list contains names that are not in the second list. If the second list contains names not in the first list. Also in your example item 1 of first list matched item 1 of second list and so on for items 2 and 3. Are you just matching against the corresponding row in the second list or against the whole list? I could make assumptions but hopefully you get what I'm saying when I say that your question is too vague.






          share|improve this answer































            0














            This might work for you.



            If your first list is in A1:A3 and your second list is in D1:D3, then enter this in cell E1:



            =IFERROR(IF(MATCH(D1,LEFT($A$1:$A$3,LEN(D1)),0)>0,1,0),0)



            Use CTRL+Shift+Enter to make it an array formula. Then copy and paste down.



            I checked it with a bad value in an extra cell D4=Donald and it will return 0 if there is no exact match.



            EDIT:



            I should probably explain that the way this formula works is that, it will take the original list A1:A3, and cut it down to the amount of characters that is in the cell we want to check it against D1.



            The LEFT($A$1:$A$3,LEN(D1)) will come back with an array of 3 values:



            {"John Smith";"Jane Doe 2";"Lucio 32, "}.



            From this list, we are looking for John Smith and an exact match (case insensitive), and since there is only one, it returns 1.



            In D2, for example, the resulting array of new values to check is:



            {"John Smi";"Jane Doe";"Lucio 32"}



            Since we're looking for Jane Doe, there is one match that exactly fits, and so 1 is returned.






            share|improve this answer

































              0














              If NameList refers to the range (e.g: $J$8:$J$10) that contains your list of names:



              This formula must be array-entered:



              =COUNT(FIND(NameList,A1))




              To array-enter a formula, after entering
              the formula into the cell or formula bar, hold down
              while hitting . If you did this
              correctly, Excel will place braces {...} around the formula.






              share|improve this answer































                0














                Correct me if I am wrong, but the way I understand your question is that the subject text and search strings already exist in a particular order, and you would simply like to compare the two strings. i.e.



                | John Smith 34, Manager  | John Smith |
                | Jane Doe 25, Assistant | Jane Doe |
                | Lucio 32, Web Developer | Lucio |


                I use the substitute() approach, to avoid overusing iferror(). You can comparing the length of the subject text ("haystack") vs the length of the haystack, substituting the search string ("needle").



                = LEN(haystack) - LEN( SUBSTITUTE(haystack, needle, "") ) > 0

                // Analysis of a matching example

                - LEN("John Smith 34, Manager") = 22
                - SUBSTITUTE("John Smith 34, Manager", "John Smith", "") = " 34, Manager"
                - LEN(" 34, Manager") = 10
                - (22 - 10) > 0 = TRUE

                // Analysis of a non-matching example

                - LEN("John Smith 34, Manager") = 22
                - SUBSTITUTE("John Smith 34, Manager", "Lucio", "") = "John Smith 34, Manager"
                - LEN("John Smith 34, Manager") = 22
                - (22 - 22) > 0 = FALSE


                In the example above, you would simply use =LEN(A1)-LEN(SUBSTITUTE(A1,B1,""))>0. Also note that you can perform case insensitive comparisons via SUBSTITUTE(UPPER(haystack), UPPER(needle), "")



                I prefer this approach over iferror(find(needle, haystack)>0,false), because the error handling is inherent -more of a philosophy that error handling should be done on the macro level rather than formulaic.



                Additionally, if you prefer the binary output (0, 1) vs the Boolean output (TRUE, FALSE), you can wrap your function in INT() (i.e. INT(TRUE) = 1, INT(FALSE) = 0).






                share|improve this answer























                  Your Answer








                  StackExchange.ready(function() {
                  var channelOptions = {
                  tags: "".split(" "),
                  id: "3"
                  };
                  initTagRenderer("".split(" "), "".split(" "), channelOptions);

                  StackExchange.using("externalEditor", function() {
                  // Have to fire editor after snippets, if snippets enabled
                  if (StackExchange.settings.snippets.snippetsEnabled) {
                  StackExchange.using("snippets", function() {
                  createEditor();
                  });
                  }
                  else {
                  createEditor();
                  }
                  });

                  function createEditor() {
                  StackExchange.prepareEditor({
                  heartbeatType: 'answer',
                  autoActivateHeartbeat: false,
                  convertImagesToLinks: true,
                  noModals: true,
                  showLowRepImageUploadWarning: true,
                  reputationToPostImages: 10,
                  bindNavPrevention: true,
                  postfix: "",
                  imageUploader: {
                  brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                  contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                  allowUrls: true
                  },
                  onDemand: true,
                  discardSelector: ".discard-answer"
                  ,immediatelyShowMarkdownHelp:true
                  });


                  }
                  });














                  draft saved

                  draft discarded


















                  StackExchange.ready(
                  function () {
                  StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1040811%2fhow-do-i-match-a-partial-string-in-cell-against-a-list-excel-2013%23new-answer', 'question_page');
                  }
                  );

                  Post as a guest















                  Required, but never shown

























                  4 Answers
                  4






                  active

                  oldest

                  votes








                  4 Answers
                  4






                  active

                  oldest

                  votes









                  active

                  oldest

                  votes






                  active

                  oldest

                  votes









                  0














                  From what you describe, the easiest way to do what you're asking for would be to write a VBA macro as the formula. But your question is too vague. For example you need to say if the first list contains names that are not in the second list. If the second list contains names not in the first list. Also in your example item 1 of first list matched item 1 of second list and so on for items 2 and 3. Are you just matching against the corresponding row in the second list or against the whole list? I could make assumptions but hopefully you get what I'm saying when I say that your question is too vague.






                  share|improve this answer




























                    0














                    From what you describe, the easiest way to do what you're asking for would be to write a VBA macro as the formula. But your question is too vague. For example you need to say if the first list contains names that are not in the second list. If the second list contains names not in the first list. Also in your example item 1 of first list matched item 1 of second list and so on for items 2 and 3. Are you just matching against the corresponding row in the second list or against the whole list? I could make assumptions but hopefully you get what I'm saying when I say that your question is too vague.






                    share|improve this answer


























                      0












                      0








                      0







                      From what you describe, the easiest way to do what you're asking for would be to write a VBA macro as the formula. But your question is too vague. For example you need to say if the first list contains names that are not in the second list. If the second list contains names not in the first list. Also in your example item 1 of first list matched item 1 of second list and so on for items 2 and 3. Are you just matching against the corresponding row in the second list or against the whole list? I could make assumptions but hopefully you get what I'm saying when I say that your question is too vague.






                      share|improve this answer













                      From what you describe, the easiest way to do what you're asking for would be to write a VBA macro as the formula. But your question is too vague. For example you need to say if the first list contains names that are not in the second list. If the second list contains names not in the first list. Also in your example item 1 of first list matched item 1 of second list and so on for items 2 and 3. Are you just matching against the corresponding row in the second list or against the whole list? I could make assumptions but hopefully you get what I'm saying when I say that your question is too vague.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Feb 14 '16 at 23:28









                      LorneCashLorneCash

                      1463




                      1463

























                          0














                          This might work for you.



                          If your first list is in A1:A3 and your second list is in D1:D3, then enter this in cell E1:



                          =IFERROR(IF(MATCH(D1,LEFT($A$1:$A$3,LEN(D1)),0)>0,1,0),0)



                          Use CTRL+Shift+Enter to make it an array formula. Then copy and paste down.



                          I checked it with a bad value in an extra cell D4=Donald and it will return 0 if there is no exact match.



                          EDIT:



                          I should probably explain that the way this formula works is that, it will take the original list A1:A3, and cut it down to the amount of characters that is in the cell we want to check it against D1.



                          The LEFT($A$1:$A$3,LEN(D1)) will come back with an array of 3 values:



                          {"John Smith";"Jane Doe 2";"Lucio 32, "}.



                          From this list, we are looking for John Smith and an exact match (case insensitive), and since there is only one, it returns 1.



                          In D2, for example, the resulting array of new values to check is:



                          {"John Smi";"Jane Doe";"Lucio 32"}



                          Since we're looking for Jane Doe, there is one match that exactly fits, and so 1 is returned.






                          share|improve this answer






























                            0














                            This might work for you.



                            If your first list is in A1:A3 and your second list is in D1:D3, then enter this in cell E1:



                            =IFERROR(IF(MATCH(D1,LEFT($A$1:$A$3,LEN(D1)),0)>0,1,0),0)



                            Use CTRL+Shift+Enter to make it an array formula. Then copy and paste down.



                            I checked it with a bad value in an extra cell D4=Donald and it will return 0 if there is no exact match.



                            EDIT:



                            I should probably explain that the way this formula works is that, it will take the original list A1:A3, and cut it down to the amount of characters that is in the cell we want to check it against D1.



                            The LEFT($A$1:$A$3,LEN(D1)) will come back with an array of 3 values:



                            {"John Smith";"Jane Doe 2";"Lucio 32, "}.



                            From this list, we are looking for John Smith and an exact match (case insensitive), and since there is only one, it returns 1.



                            In D2, for example, the resulting array of new values to check is:



                            {"John Smi";"Jane Doe";"Lucio 32"}



                            Since we're looking for Jane Doe, there is one match that exactly fits, and so 1 is returned.






                            share|improve this answer




























                              0












                              0








                              0







                              This might work for you.



                              If your first list is in A1:A3 and your second list is in D1:D3, then enter this in cell E1:



                              =IFERROR(IF(MATCH(D1,LEFT($A$1:$A$3,LEN(D1)),0)>0,1,0),0)



                              Use CTRL+Shift+Enter to make it an array formula. Then copy and paste down.



                              I checked it with a bad value in an extra cell D4=Donald and it will return 0 if there is no exact match.



                              EDIT:



                              I should probably explain that the way this formula works is that, it will take the original list A1:A3, and cut it down to the amount of characters that is in the cell we want to check it against D1.



                              The LEFT($A$1:$A$3,LEN(D1)) will come back with an array of 3 values:



                              {"John Smith";"Jane Doe 2";"Lucio 32, "}.



                              From this list, we are looking for John Smith and an exact match (case insensitive), and since there is only one, it returns 1.



                              In D2, for example, the resulting array of new values to check is:



                              {"John Smi";"Jane Doe";"Lucio 32"}



                              Since we're looking for Jane Doe, there is one match that exactly fits, and so 1 is returned.






                              share|improve this answer















                              This might work for you.



                              If your first list is in A1:A3 and your second list is in D1:D3, then enter this in cell E1:



                              =IFERROR(IF(MATCH(D1,LEFT($A$1:$A$3,LEN(D1)),0)>0,1,0),0)



                              Use CTRL+Shift+Enter to make it an array formula. Then copy and paste down.



                              I checked it with a bad value in an extra cell D4=Donald and it will return 0 if there is no exact match.



                              EDIT:



                              I should probably explain that the way this formula works is that, it will take the original list A1:A3, and cut it down to the amount of characters that is in the cell we want to check it against D1.



                              The LEFT($A$1:$A$3,LEN(D1)) will come back with an array of 3 values:



                              {"John Smith";"Jane Doe 2";"Lucio 32, "}.



                              From this list, we are looking for John Smith and an exact match (case insensitive), and since there is only one, it returns 1.



                              In D2, for example, the resulting array of new values to check is:



                              {"John Smi";"Jane Doe";"Lucio 32"}



                              Since we're looking for Jane Doe, there is one match that exactly fits, and so 1 is returned.







                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited Feb 14 '16 at 23:34

























                              answered Feb 14 '16 at 23:27









                              JosephJoseph

                              70845




                              70845























                                  0














                                  If NameList refers to the range (e.g: $J$8:$J$10) that contains your list of names:



                                  This formula must be array-entered:



                                  =COUNT(FIND(NameList,A1))




                                  To array-enter a formula, after entering
                                  the formula into the cell or formula bar, hold down
                                  while hitting . If you did this
                                  correctly, Excel will place braces {...} around the formula.






                                  share|improve this answer




























                                    0














                                    If NameList refers to the range (e.g: $J$8:$J$10) that contains your list of names:



                                    This formula must be array-entered:



                                    =COUNT(FIND(NameList,A1))




                                    To array-enter a formula, after entering
                                    the formula into the cell or formula bar, hold down
                                    while hitting . If you did this
                                    correctly, Excel will place braces {...} around the formula.






                                    share|improve this answer


























                                      0












                                      0








                                      0







                                      If NameList refers to the range (e.g: $J$8:$J$10) that contains your list of names:



                                      This formula must be array-entered:



                                      =COUNT(FIND(NameList,A1))




                                      To array-enter a formula, after entering
                                      the formula into the cell or formula bar, hold down
                                      while hitting . If you did this
                                      correctly, Excel will place braces {...} around the formula.






                                      share|improve this answer













                                      If NameList refers to the range (e.g: $J$8:$J$10) that contains your list of names:



                                      This formula must be array-entered:



                                      =COUNT(FIND(NameList,A1))




                                      To array-enter a formula, after entering
                                      the formula into the cell or formula bar, hold down
                                      while hitting . If you did this
                                      correctly, Excel will place braces {...} around the formula.







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Feb 15 '16 at 13:34









                                      Ron RosenfeldRon Rosenfeld

                                      2,0342611




                                      2,0342611























                                          0














                                          Correct me if I am wrong, but the way I understand your question is that the subject text and search strings already exist in a particular order, and you would simply like to compare the two strings. i.e.



                                          | John Smith 34, Manager  | John Smith |
                                          | Jane Doe 25, Assistant | Jane Doe |
                                          | Lucio 32, Web Developer | Lucio |


                                          I use the substitute() approach, to avoid overusing iferror(). You can comparing the length of the subject text ("haystack") vs the length of the haystack, substituting the search string ("needle").



                                          = LEN(haystack) - LEN( SUBSTITUTE(haystack, needle, "") ) > 0

                                          // Analysis of a matching example

                                          - LEN("John Smith 34, Manager") = 22
                                          - SUBSTITUTE("John Smith 34, Manager", "John Smith", "") = " 34, Manager"
                                          - LEN(" 34, Manager") = 10
                                          - (22 - 10) > 0 = TRUE

                                          // Analysis of a non-matching example

                                          - LEN("John Smith 34, Manager") = 22
                                          - SUBSTITUTE("John Smith 34, Manager", "Lucio", "") = "John Smith 34, Manager"
                                          - LEN("John Smith 34, Manager") = 22
                                          - (22 - 22) > 0 = FALSE


                                          In the example above, you would simply use =LEN(A1)-LEN(SUBSTITUTE(A1,B1,""))>0. Also note that you can perform case insensitive comparisons via SUBSTITUTE(UPPER(haystack), UPPER(needle), "")



                                          I prefer this approach over iferror(find(needle, haystack)>0,false), because the error handling is inherent -more of a philosophy that error handling should be done on the macro level rather than formulaic.



                                          Additionally, if you prefer the binary output (0, 1) vs the Boolean output (TRUE, FALSE), you can wrap your function in INT() (i.e. INT(TRUE) = 1, INT(FALSE) = 0).






                                          share|improve this answer




























                                            0














                                            Correct me if I am wrong, but the way I understand your question is that the subject text and search strings already exist in a particular order, and you would simply like to compare the two strings. i.e.



                                            | John Smith 34, Manager  | John Smith |
                                            | Jane Doe 25, Assistant | Jane Doe |
                                            | Lucio 32, Web Developer | Lucio |


                                            I use the substitute() approach, to avoid overusing iferror(). You can comparing the length of the subject text ("haystack") vs the length of the haystack, substituting the search string ("needle").



                                            = LEN(haystack) - LEN( SUBSTITUTE(haystack, needle, "") ) > 0

                                            // Analysis of a matching example

                                            - LEN("John Smith 34, Manager") = 22
                                            - SUBSTITUTE("John Smith 34, Manager", "John Smith", "") = " 34, Manager"
                                            - LEN(" 34, Manager") = 10
                                            - (22 - 10) > 0 = TRUE

                                            // Analysis of a non-matching example

                                            - LEN("John Smith 34, Manager") = 22
                                            - SUBSTITUTE("John Smith 34, Manager", "Lucio", "") = "John Smith 34, Manager"
                                            - LEN("John Smith 34, Manager") = 22
                                            - (22 - 22) > 0 = FALSE


                                            In the example above, you would simply use =LEN(A1)-LEN(SUBSTITUTE(A1,B1,""))>0. Also note that you can perform case insensitive comparisons via SUBSTITUTE(UPPER(haystack), UPPER(needle), "")



                                            I prefer this approach over iferror(find(needle, haystack)>0,false), because the error handling is inherent -more of a philosophy that error handling should be done on the macro level rather than formulaic.



                                            Additionally, if you prefer the binary output (0, 1) vs the Boolean output (TRUE, FALSE), you can wrap your function in INT() (i.e. INT(TRUE) = 1, INT(FALSE) = 0).






                                            share|improve this answer


























                                              0












                                              0








                                              0







                                              Correct me if I am wrong, but the way I understand your question is that the subject text and search strings already exist in a particular order, and you would simply like to compare the two strings. i.e.



                                              | John Smith 34, Manager  | John Smith |
                                              | Jane Doe 25, Assistant | Jane Doe |
                                              | Lucio 32, Web Developer | Lucio |


                                              I use the substitute() approach, to avoid overusing iferror(). You can comparing the length of the subject text ("haystack") vs the length of the haystack, substituting the search string ("needle").



                                              = LEN(haystack) - LEN( SUBSTITUTE(haystack, needle, "") ) > 0

                                              // Analysis of a matching example

                                              - LEN("John Smith 34, Manager") = 22
                                              - SUBSTITUTE("John Smith 34, Manager", "John Smith", "") = " 34, Manager"
                                              - LEN(" 34, Manager") = 10
                                              - (22 - 10) > 0 = TRUE

                                              // Analysis of a non-matching example

                                              - LEN("John Smith 34, Manager") = 22
                                              - SUBSTITUTE("John Smith 34, Manager", "Lucio", "") = "John Smith 34, Manager"
                                              - LEN("John Smith 34, Manager") = 22
                                              - (22 - 22) > 0 = FALSE


                                              In the example above, you would simply use =LEN(A1)-LEN(SUBSTITUTE(A1,B1,""))>0. Also note that you can perform case insensitive comparisons via SUBSTITUTE(UPPER(haystack), UPPER(needle), "")



                                              I prefer this approach over iferror(find(needle, haystack)>0,false), because the error handling is inherent -more of a philosophy that error handling should be done on the macro level rather than formulaic.



                                              Additionally, if you prefer the binary output (0, 1) vs the Boolean output (TRUE, FALSE), you can wrap your function in INT() (i.e. INT(TRUE) = 1, INT(FALSE) = 0).






                                              share|improve this answer













                                              Correct me if I am wrong, but the way I understand your question is that the subject text and search strings already exist in a particular order, and you would simply like to compare the two strings. i.e.



                                              | John Smith 34, Manager  | John Smith |
                                              | Jane Doe 25, Assistant | Jane Doe |
                                              | Lucio 32, Web Developer | Lucio |


                                              I use the substitute() approach, to avoid overusing iferror(). You can comparing the length of the subject text ("haystack") vs the length of the haystack, substituting the search string ("needle").



                                              = LEN(haystack) - LEN( SUBSTITUTE(haystack, needle, "") ) > 0

                                              // Analysis of a matching example

                                              - LEN("John Smith 34, Manager") = 22
                                              - SUBSTITUTE("John Smith 34, Manager", "John Smith", "") = " 34, Manager"
                                              - LEN(" 34, Manager") = 10
                                              - (22 - 10) > 0 = TRUE

                                              // Analysis of a non-matching example

                                              - LEN("John Smith 34, Manager") = 22
                                              - SUBSTITUTE("John Smith 34, Manager", "Lucio", "") = "John Smith 34, Manager"
                                              - LEN("John Smith 34, Manager") = 22
                                              - (22 - 22) > 0 = FALSE


                                              In the example above, you would simply use =LEN(A1)-LEN(SUBSTITUTE(A1,B1,""))>0. Also note that you can perform case insensitive comparisons via SUBSTITUTE(UPPER(haystack), UPPER(needle), "")



                                              I prefer this approach over iferror(find(needle, haystack)>0,false), because the error handling is inherent -more of a philosophy that error handling should be done on the macro level rather than formulaic.



                                              Additionally, if you prefer the binary output (0, 1) vs the Boolean output (TRUE, FALSE), you can wrap your function in INT() (i.e. INT(TRUE) = 1, INT(FALSE) = 0).







                                              share|improve this answer












                                              share|improve this answer



                                              share|improve this answer










                                              answered Feb 15 '16 at 16:36









                                              jtrumbulljtrumbull

                                              1362




                                              1362






























                                                  draft saved

                                                  draft discarded




















































                                                  Thanks for contributing an answer to Super User!


                                                  • Please be sure to answer the question. Provide details and share your research!

                                                  But avoid



                                                  • Asking for help, clarification, or responding to other answers.

                                                  • Making statements based on opinion; back them up with references or personal experience.


                                                  To learn more, see our tips on writing great answers.




                                                  draft saved


                                                  draft discarded














                                                  StackExchange.ready(
                                                  function () {
                                                  StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1040811%2fhow-do-i-match-a-partial-string-in-cell-against-a-list-excel-2013%23new-answer', 'question_page');
                                                  }
                                                  );

                                                  Post as a guest















                                                  Required, but never shown





















































                                                  Required, but never shown














                                                  Required, but never shown












                                                  Required, but never shown







                                                  Required, but never shown

































                                                  Required, but never shown














                                                  Required, but never shown












                                                  Required, but never shown







                                                  Required, but never shown







                                                  Popular posts from this blog

                                                  Why not use the yoke to control yaw, as well as pitch and roll? Announcing the arrival of...

                                                  Couldn't open a raw socket. Error: Permission denied (13) (nmap)Is it possible to run networking commands...

                                                  VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...