Combining first two letters from first name and first two letters from last name











up vote
6
down vote

favorite
2












I have a spreadsheet of usernames.



The first and last names are in the same cell of column A.



Is there a formula that will concatenate the first two letters of the first name (first word) and the first two letters of second name (second word)?



For example John Doe, should become JoDo.



I tried



=LEFT(A1)&MID(A1,IFERROR(FIND(" ",A1),LEN(A1))+1,IFERROR(FIND(" ",SUBSTITUTE(A1," ","",1)),LEN(A1))-IFERROR(FIND(" ",A1),LEN(A1)))


but this gives me JoDoe as the result.










share|improve this question









New contributor




prweq is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • @Tetsujin OP has now included their attempt to solve the issue.
    – PeterH
    13 hours ago






  • 1




    @PeterH - cool. vote retracted.
    – Tetsujin
    13 hours ago















up vote
6
down vote

favorite
2












I have a spreadsheet of usernames.



The first and last names are in the same cell of column A.



Is there a formula that will concatenate the first two letters of the first name (first word) and the first two letters of second name (second word)?



For example John Doe, should become JoDo.



I tried



=LEFT(A1)&MID(A1,IFERROR(FIND(" ",A1),LEN(A1))+1,IFERROR(FIND(" ",SUBSTITUTE(A1," ","",1)),LEN(A1))-IFERROR(FIND(" ",A1),LEN(A1)))


but this gives me JoDoe as the result.










share|improve this question









New contributor




prweq is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • @Tetsujin OP has now included their attempt to solve the issue.
    – PeterH
    13 hours ago






  • 1




    @PeterH - cool. vote retracted.
    – Tetsujin
    13 hours ago













up vote
6
down vote

favorite
2









up vote
6
down vote

favorite
2






2





I have a spreadsheet of usernames.



The first and last names are in the same cell of column A.



Is there a formula that will concatenate the first two letters of the first name (first word) and the first two letters of second name (second word)?



For example John Doe, should become JoDo.



I tried



=LEFT(A1)&MID(A1,IFERROR(FIND(" ",A1),LEN(A1))+1,IFERROR(FIND(" ",SUBSTITUTE(A1," ","",1)),LEN(A1))-IFERROR(FIND(" ",A1),LEN(A1)))


but this gives me JoDoe as the result.










share|improve this question









New contributor




prweq is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I have a spreadsheet of usernames.



The first and last names are in the same cell of column A.



Is there a formula that will concatenate the first two letters of the first name (first word) and the first two letters of second name (second word)?



For example John Doe, should become JoDo.



I tried



=LEFT(A1)&MID(A1,IFERROR(FIND(" ",A1),LEN(A1))+1,IFERROR(FIND(" ",SUBSTITUTE(A1," ","",1)),LEN(A1))-IFERROR(FIND(" ",A1),LEN(A1)))


but this gives me JoDoe as the result.







microsoft-excel worksheet-function microsoft-excel-2013






share|improve this question









New contributor




prweq is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




prweq is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 8 hours ago









robinCTS

3,84041527




3,84041527






New contributor




prweq is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 13 hours ago









prweq

313




313




New contributor




prweq is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





prweq is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






prweq is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • @Tetsujin OP has now included their attempt to solve the issue.
    – PeterH
    13 hours ago






  • 1




    @PeterH - cool. vote retracted.
    – Tetsujin
    13 hours ago


















  • @Tetsujin OP has now included their attempt to solve the issue.
    – PeterH
    13 hours ago






  • 1




    @PeterH - cool. vote retracted.
    – Tetsujin
    13 hours ago
















@Tetsujin OP has now included their attempt to solve the issue.
– PeterH
13 hours ago




@Tetsujin OP has now included their attempt to solve the issue.
– PeterH
13 hours ago




1




1




@PeterH - cool. vote retracted.
– Tetsujin
13 hours ago




@PeterH - cool. vote retracted.
– Tetsujin
13 hours ago










4 Answers
4






active

oldest

votes

















up vote
12
down vote













Yes; assuming each person only has a First and Last name, and this is always separated by a space you can use the below:



=LEFT(A1,2)&MID(A1,SEARCH(" ",A1)+1,2)


I could only base this answer on those assumptions as it is all you provided.



Or if you want a space to still be included:



=LEFT(A1,2)&" "&MID(A1,SEARCH(" ",A1)+1,2)





share|improve this answer





















  • Thank you very much for your answer.
    – prweq
    13 hours ago






  • 1




    @prweq no probs, accept it as correct if it works for you
    – PeterH
    13 hours ago










  • Simplest and easiest to understand solution. (Well, except for using FIND() instead of SEARCH();-) ) Since you are assuming there is always a space separator, your second formula can be simplified to =LEFT(A1,2)&MID(A1,SEARCH(" ",A1),3)
    – robinCTS
    1 hour ago


















up vote
4
down vote













This is another way...



Screenshot of worksheet




  • A - Name

  • B - =CONCATENATE(LEFT(A1,2),LEFT(RIGHT(A1,(LEN(A1)-FIND(" ",A1))),2))






share|improve this answer























  • You could go even further and remove all those extra columns by merging them =CONCATENATE(LEFT(A1,2),LEFT(RIGHT(A1,(LEN(A1)-FIND(" ",A1))),2))
    – PeterH
    13 hours ago










  • Yeah, I did that a few moments after!
    – Stese
    13 hours ago










  • yeah I noticed you edited the answer, Nice Answer !
    – PeterH
    13 hours ago


















up vote
3
down vote













And to round things out, here's a solution that will return the first two characters of the first name, and the first two characters of the last name, but also accounts for middle names.



=LEFT(A1,2)&LEFT(MID(A1,FIND("~~~~~",SUBSTITUTE(A1," ","~~~~~",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))+1,LEN(A1)),2)


enter image description here






share|improve this answer





















  • You beat me to it ;-) (It was well past midnight and I need to sleep - was planning on adding this to my answer afterwards.) A slight improvement to your formula would be to use a single ~ instead of four. If you are concerned that a Tilda might be used as part of a name (!) or, more likely, been accidentally typed, just use a character that doesn't appear on any keyboard. I prefer to use §. is another good one.
    – robinCTS
    1 hour ago




















up vote
0
down vote













First off, I'd like to say that PeterH's answer is the simplest and easiest to understand. (Although my preference is to use FIND() instead of SEARCH() - typing two less characters helps in avoiding RSI ;-) )



An alternative answer that neither uses MID(), LEFT() nor RIGHT(), but instead uses REPLACE() to remove the unwanted parts of the name is as follows:



=REPLACE(REPLACE(A1,FIND(" ",A1)+3,LEN(A1),""),3,FIND(" ",A1)-2,"")


Explanation:



The inner REPLACE() removes the characters from the third character of the last name onward, whilst the outer REPLACE() removes the characters from the third character of the first name up until the space.





Addendum 1:



The above formula can also be adapted to allow for a single middle name:



=REPLACE(REPLACE(A1,IFERROR(FIND(" ",A1,FIND(" ",A1)+1),FIND(" ",A1))+3,LEN(A1),""),3,IFERROR(FIND(" ",A1,FIND(" ",A1)+1),FIND(" ",A1))-2,"")


This (long-winded) version allows for any number of middle names:



=REPLACE(REPLACE(A1,FIND("§",SUBSTITUTE(A1," ","§",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))+3,LEN(A1),""),3,FIND("§",SUBSTITUTE(A1," ","§",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))-2,"")


Note that, of course, BruceWayne's answer is the simplest and easiest to understand solution that allows for any number of middle names.





Addendum 2:



All of the solutions can be adapted to cater for the case of a single name only by wrapping them within an IFERROR() function like so:



=IFERROR(solution, alternate_formula)



Note that the above is a general case formula, and it might be possible to tailor a more efficient modification to a specific solution. For example, if the requirement in the case of a single name is to join the first two letters with the last two letters, PeterH's answer can be more efficiently adapted like this:



=LEFT(A1,2)&MID(A1,IFERROR(SEARCH(" ",A1)+1,LEN(A1)-1),2)




To allow for the case of an initial instead of the first name (assuming a space or dot is not acceptable as the second character) the following can be used with any solution:



=SUBSTITUTE(SUBSTITUTE(solution, " ", single_char), ".", single_char))



Note that the single character can be either hard-coded or calculated from the name.





Finally, if you really need to cater for a single character only for the full name (!), just wrap the single-name-only formula with another IFERROR(). (Assuming, of course, that the alternate formula doesn't take care of that special case.)





Addendum 3:



Finally, finally (no, really ;-) ) to cater for multiple consecutive spaces, use TRIM(A1) instead of A1.






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',
    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
    });


    }
    });






    prweq is a new contributor. Be nice, and check out our Code of Conduct.










    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1382305%2fcombining-first-two-letters-from-first-name-and-first-two-letters-from-last-name%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








    up vote
    12
    down vote













    Yes; assuming each person only has a First and Last name, and this is always separated by a space you can use the below:



    =LEFT(A1,2)&MID(A1,SEARCH(" ",A1)+1,2)


    I could only base this answer on those assumptions as it is all you provided.



    Or if you want a space to still be included:



    =LEFT(A1,2)&" "&MID(A1,SEARCH(" ",A1)+1,2)





    share|improve this answer





















    • Thank you very much for your answer.
      – prweq
      13 hours ago






    • 1




      @prweq no probs, accept it as correct if it works for you
      – PeterH
      13 hours ago










    • Simplest and easiest to understand solution. (Well, except for using FIND() instead of SEARCH();-) ) Since you are assuming there is always a space separator, your second formula can be simplified to =LEFT(A1,2)&MID(A1,SEARCH(" ",A1),3)
      – robinCTS
      1 hour ago















    up vote
    12
    down vote













    Yes; assuming each person only has a First and Last name, and this is always separated by a space you can use the below:



    =LEFT(A1,2)&MID(A1,SEARCH(" ",A1)+1,2)


    I could only base this answer on those assumptions as it is all you provided.



    Or if you want a space to still be included:



    =LEFT(A1,2)&" "&MID(A1,SEARCH(" ",A1)+1,2)





    share|improve this answer





















    • Thank you very much for your answer.
      – prweq
      13 hours ago






    • 1




      @prweq no probs, accept it as correct if it works for you
      – PeterH
      13 hours ago










    • Simplest and easiest to understand solution. (Well, except for using FIND() instead of SEARCH();-) ) Since you are assuming there is always a space separator, your second formula can be simplified to =LEFT(A1,2)&MID(A1,SEARCH(" ",A1),3)
      – robinCTS
      1 hour ago













    up vote
    12
    down vote










    up vote
    12
    down vote









    Yes; assuming each person only has a First and Last name, and this is always separated by a space you can use the below:



    =LEFT(A1,2)&MID(A1,SEARCH(" ",A1)+1,2)


    I could only base this answer on those assumptions as it is all you provided.



    Or if you want a space to still be included:



    =LEFT(A1,2)&" "&MID(A1,SEARCH(" ",A1)+1,2)





    share|improve this answer












    Yes; assuming each person only has a First and Last name, and this is always separated by a space you can use the below:



    =LEFT(A1,2)&MID(A1,SEARCH(" ",A1)+1,2)


    I could only base this answer on those assumptions as it is all you provided.



    Or if you want a space to still be included:



    =LEFT(A1,2)&" "&MID(A1,SEARCH(" ",A1)+1,2)






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered 13 hours ago









    PeterH

    3,29632246




    3,29632246












    • Thank you very much for your answer.
      – prweq
      13 hours ago






    • 1




      @prweq no probs, accept it as correct if it works for you
      – PeterH
      13 hours ago










    • Simplest and easiest to understand solution. (Well, except for using FIND() instead of SEARCH();-) ) Since you are assuming there is always a space separator, your second formula can be simplified to =LEFT(A1,2)&MID(A1,SEARCH(" ",A1),3)
      – robinCTS
      1 hour ago


















    • Thank you very much for your answer.
      – prweq
      13 hours ago






    • 1




      @prweq no probs, accept it as correct if it works for you
      – PeterH
      13 hours ago










    • Simplest and easiest to understand solution. (Well, except for using FIND() instead of SEARCH();-) ) Since you are assuming there is always a space separator, your second formula can be simplified to =LEFT(A1,2)&MID(A1,SEARCH(" ",A1),3)
      – robinCTS
      1 hour ago
















    Thank you very much for your answer.
    – prweq
    13 hours ago




    Thank you very much for your answer.
    – prweq
    13 hours ago




    1




    1




    @prweq no probs, accept it as correct if it works for you
    – PeterH
    13 hours ago




    @prweq no probs, accept it as correct if it works for you
    – PeterH
    13 hours ago












    Simplest and easiest to understand solution. (Well, except for using FIND() instead of SEARCH();-) ) Since you are assuming there is always a space separator, your second formula can be simplified to =LEFT(A1,2)&MID(A1,SEARCH(" ",A1),3)
    – robinCTS
    1 hour ago




    Simplest and easiest to understand solution. (Well, except for using FIND() instead of SEARCH();-) ) Since you are assuming there is always a space separator, your second formula can be simplified to =LEFT(A1,2)&MID(A1,SEARCH(" ",A1),3)
    – robinCTS
    1 hour ago












    up vote
    4
    down vote













    This is another way...



    Screenshot of worksheet




    • A - Name

    • B - =CONCATENATE(LEFT(A1,2),LEFT(RIGHT(A1,(LEN(A1)-FIND(" ",A1))),2))






    share|improve this answer























    • You could go even further and remove all those extra columns by merging them =CONCATENATE(LEFT(A1,2),LEFT(RIGHT(A1,(LEN(A1)-FIND(" ",A1))),2))
      – PeterH
      13 hours ago










    • Yeah, I did that a few moments after!
      – Stese
      13 hours ago










    • yeah I noticed you edited the answer, Nice Answer !
      – PeterH
      13 hours ago















    up vote
    4
    down vote













    This is another way...



    Screenshot of worksheet




    • A - Name

    • B - =CONCATENATE(LEFT(A1,2),LEFT(RIGHT(A1,(LEN(A1)-FIND(" ",A1))),2))






    share|improve this answer























    • You could go even further and remove all those extra columns by merging them =CONCATENATE(LEFT(A1,2),LEFT(RIGHT(A1,(LEN(A1)-FIND(" ",A1))),2))
      – PeterH
      13 hours ago










    • Yeah, I did that a few moments after!
      – Stese
      13 hours ago










    • yeah I noticed you edited the answer, Nice Answer !
      – PeterH
      13 hours ago













    up vote
    4
    down vote










    up vote
    4
    down vote









    This is another way...



    Screenshot of worksheet




    • A - Name

    • B - =CONCATENATE(LEFT(A1,2),LEFT(RIGHT(A1,(LEN(A1)-FIND(" ",A1))),2))






    share|improve this answer














    This is another way...



    Screenshot of worksheet




    • A - Name

    • B - =CONCATENATE(LEFT(A1,2),LEFT(RIGHT(A1,(LEN(A1)-FIND(" ",A1))),2))







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 1 hour ago









    robinCTS

    3,84041527




    3,84041527










    answered 13 hours ago









    Stese

    762414




    762414












    • You could go even further and remove all those extra columns by merging them =CONCATENATE(LEFT(A1,2),LEFT(RIGHT(A1,(LEN(A1)-FIND(" ",A1))),2))
      – PeterH
      13 hours ago










    • Yeah, I did that a few moments after!
      – Stese
      13 hours ago










    • yeah I noticed you edited the answer, Nice Answer !
      – PeterH
      13 hours ago


















    • You could go even further and remove all those extra columns by merging them =CONCATENATE(LEFT(A1,2),LEFT(RIGHT(A1,(LEN(A1)-FIND(" ",A1))),2))
      – PeterH
      13 hours ago










    • Yeah, I did that a few moments after!
      – Stese
      13 hours ago










    • yeah I noticed you edited the answer, Nice Answer !
      – PeterH
      13 hours ago
















    You could go even further and remove all those extra columns by merging them =CONCATENATE(LEFT(A1,2),LEFT(RIGHT(A1,(LEN(A1)-FIND(" ",A1))),2))
    – PeterH
    13 hours ago




    You could go even further and remove all those extra columns by merging them =CONCATENATE(LEFT(A1,2),LEFT(RIGHT(A1,(LEN(A1)-FIND(" ",A1))),2))
    – PeterH
    13 hours ago












    Yeah, I did that a few moments after!
    – Stese
    13 hours ago




    Yeah, I did that a few moments after!
    – Stese
    13 hours ago












    yeah I noticed you edited the answer, Nice Answer !
    – PeterH
    13 hours ago




    yeah I noticed you edited the answer, Nice Answer !
    – PeterH
    13 hours ago










    up vote
    3
    down vote













    And to round things out, here's a solution that will return the first two characters of the first name, and the first two characters of the last name, but also accounts for middle names.



    =LEFT(A1,2)&LEFT(MID(A1,FIND("~~~~~",SUBSTITUTE(A1," ","~~~~~",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))+1,LEN(A1)),2)


    enter image description here






    share|improve this answer





















    • You beat me to it ;-) (It was well past midnight and I need to sleep - was planning on adding this to my answer afterwards.) A slight improvement to your formula would be to use a single ~ instead of four. If you are concerned that a Tilda might be used as part of a name (!) or, more likely, been accidentally typed, just use a character that doesn't appear on any keyboard. I prefer to use §. is another good one.
      – robinCTS
      1 hour ago

















    up vote
    3
    down vote













    And to round things out, here's a solution that will return the first two characters of the first name, and the first two characters of the last name, but also accounts for middle names.



    =LEFT(A1,2)&LEFT(MID(A1,FIND("~~~~~",SUBSTITUTE(A1," ","~~~~~",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))+1,LEN(A1)),2)


    enter image description here






    share|improve this answer





















    • You beat me to it ;-) (It was well past midnight and I need to sleep - was planning on adding this to my answer afterwards.) A slight improvement to your formula would be to use a single ~ instead of four. If you are concerned that a Tilda might be used as part of a name (!) or, more likely, been accidentally typed, just use a character that doesn't appear on any keyboard. I prefer to use §. is another good one.
      – robinCTS
      1 hour ago















    up vote
    3
    down vote










    up vote
    3
    down vote









    And to round things out, here's a solution that will return the first two characters of the first name, and the first two characters of the last name, but also accounts for middle names.



    =LEFT(A1,2)&LEFT(MID(A1,FIND("~~~~~",SUBSTITUTE(A1," ","~~~~~",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))+1,LEN(A1)),2)


    enter image description here






    share|improve this answer












    And to round things out, here's a solution that will return the first two characters of the first name, and the first two characters of the last name, but also accounts for middle names.



    =LEFT(A1,2)&LEFT(MID(A1,FIND("~~~~~",SUBSTITUTE(A1," ","~~~~~",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))+1,LEN(A1)),2)


    enter image description here







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered 8 hours ago









    BruceWayne

    1,4721718




    1,4721718












    • You beat me to it ;-) (It was well past midnight and I need to sleep - was planning on adding this to my answer afterwards.) A slight improvement to your formula would be to use a single ~ instead of four. If you are concerned that a Tilda might be used as part of a name (!) or, more likely, been accidentally typed, just use a character that doesn't appear on any keyboard. I prefer to use §. is another good one.
      – robinCTS
      1 hour ago




















    • You beat me to it ;-) (It was well past midnight and I need to sleep - was planning on adding this to my answer afterwards.) A slight improvement to your formula would be to use a single ~ instead of four. If you are concerned that a Tilda might be used as part of a name (!) or, more likely, been accidentally typed, just use a character that doesn't appear on any keyboard. I prefer to use §. is another good one.
      – robinCTS
      1 hour ago


















    You beat me to it ;-) (It was well past midnight and I need to sleep - was planning on adding this to my answer afterwards.) A slight improvement to your formula would be to use a single ~ instead of four. If you are concerned that a Tilda might be used as part of a name (!) or, more likely, been accidentally typed, just use a character that doesn't appear on any keyboard. I prefer to use §. is another good one.
    – robinCTS
    1 hour ago






    You beat me to it ;-) (It was well past midnight and I need to sleep - was planning on adding this to my answer afterwards.) A slight improvement to your formula would be to use a single ~ instead of four. If you are concerned that a Tilda might be used as part of a name (!) or, more likely, been accidentally typed, just use a character that doesn't appear on any keyboard. I prefer to use §. is another good one.
    – robinCTS
    1 hour ago












    up vote
    0
    down vote













    First off, I'd like to say that PeterH's answer is the simplest and easiest to understand. (Although my preference is to use FIND() instead of SEARCH() - typing two less characters helps in avoiding RSI ;-) )



    An alternative answer that neither uses MID(), LEFT() nor RIGHT(), but instead uses REPLACE() to remove the unwanted parts of the name is as follows:



    =REPLACE(REPLACE(A1,FIND(" ",A1)+3,LEN(A1),""),3,FIND(" ",A1)-2,"")


    Explanation:



    The inner REPLACE() removes the characters from the third character of the last name onward, whilst the outer REPLACE() removes the characters from the third character of the first name up until the space.





    Addendum 1:



    The above formula can also be adapted to allow for a single middle name:



    =REPLACE(REPLACE(A1,IFERROR(FIND(" ",A1,FIND(" ",A1)+1),FIND(" ",A1))+3,LEN(A1),""),3,IFERROR(FIND(" ",A1,FIND(" ",A1)+1),FIND(" ",A1))-2,"")


    This (long-winded) version allows for any number of middle names:



    =REPLACE(REPLACE(A1,FIND("§",SUBSTITUTE(A1," ","§",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))+3,LEN(A1),""),3,FIND("§",SUBSTITUTE(A1," ","§",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))-2,"")


    Note that, of course, BruceWayne's answer is the simplest and easiest to understand solution that allows for any number of middle names.





    Addendum 2:



    All of the solutions can be adapted to cater for the case of a single name only by wrapping them within an IFERROR() function like so:



    =IFERROR(solution, alternate_formula)



    Note that the above is a general case formula, and it might be possible to tailor a more efficient modification to a specific solution. For example, if the requirement in the case of a single name is to join the first two letters with the last two letters, PeterH's answer can be more efficiently adapted like this:



    =LEFT(A1,2)&MID(A1,IFERROR(SEARCH(" ",A1)+1,LEN(A1)-1),2)




    To allow for the case of an initial instead of the first name (assuming a space or dot is not acceptable as the second character) the following can be used with any solution:



    =SUBSTITUTE(SUBSTITUTE(solution, " ", single_char), ".", single_char))



    Note that the single character can be either hard-coded or calculated from the name.





    Finally, if you really need to cater for a single character only for the full name (!), just wrap the single-name-only formula with another IFERROR(). (Assuming, of course, that the alternate formula doesn't take care of that special case.)





    Addendum 3:



    Finally, finally (no, really ;-) ) to cater for multiple consecutive spaces, use TRIM(A1) instead of A1.






    share|improve this answer



























      up vote
      0
      down vote













      First off, I'd like to say that PeterH's answer is the simplest and easiest to understand. (Although my preference is to use FIND() instead of SEARCH() - typing two less characters helps in avoiding RSI ;-) )



      An alternative answer that neither uses MID(), LEFT() nor RIGHT(), but instead uses REPLACE() to remove the unwanted parts of the name is as follows:



      =REPLACE(REPLACE(A1,FIND(" ",A1)+3,LEN(A1),""),3,FIND(" ",A1)-2,"")


      Explanation:



      The inner REPLACE() removes the characters from the third character of the last name onward, whilst the outer REPLACE() removes the characters from the third character of the first name up until the space.





      Addendum 1:



      The above formula can also be adapted to allow for a single middle name:



      =REPLACE(REPLACE(A1,IFERROR(FIND(" ",A1,FIND(" ",A1)+1),FIND(" ",A1))+3,LEN(A1),""),3,IFERROR(FIND(" ",A1,FIND(" ",A1)+1),FIND(" ",A1))-2,"")


      This (long-winded) version allows for any number of middle names:



      =REPLACE(REPLACE(A1,FIND("§",SUBSTITUTE(A1," ","§",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))+3,LEN(A1),""),3,FIND("§",SUBSTITUTE(A1," ","§",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))-2,"")


      Note that, of course, BruceWayne's answer is the simplest and easiest to understand solution that allows for any number of middle names.





      Addendum 2:



      All of the solutions can be adapted to cater for the case of a single name only by wrapping them within an IFERROR() function like so:



      =IFERROR(solution, alternate_formula)



      Note that the above is a general case formula, and it might be possible to tailor a more efficient modification to a specific solution. For example, if the requirement in the case of a single name is to join the first two letters with the last two letters, PeterH's answer can be more efficiently adapted like this:



      =LEFT(A1,2)&MID(A1,IFERROR(SEARCH(" ",A1)+1,LEN(A1)-1),2)




      To allow for the case of an initial instead of the first name (assuming a space or dot is not acceptable as the second character) the following can be used with any solution:



      =SUBSTITUTE(SUBSTITUTE(solution, " ", single_char), ".", single_char))



      Note that the single character can be either hard-coded or calculated from the name.





      Finally, if you really need to cater for a single character only for the full name (!), just wrap the single-name-only formula with another IFERROR(). (Assuming, of course, that the alternate formula doesn't take care of that special case.)





      Addendum 3:



      Finally, finally (no, really ;-) ) to cater for multiple consecutive spaces, use TRIM(A1) instead of A1.






      share|improve this answer

























        up vote
        0
        down vote










        up vote
        0
        down vote









        First off, I'd like to say that PeterH's answer is the simplest and easiest to understand. (Although my preference is to use FIND() instead of SEARCH() - typing two less characters helps in avoiding RSI ;-) )



        An alternative answer that neither uses MID(), LEFT() nor RIGHT(), but instead uses REPLACE() to remove the unwanted parts of the name is as follows:



        =REPLACE(REPLACE(A1,FIND(" ",A1)+3,LEN(A1),""),3,FIND(" ",A1)-2,"")


        Explanation:



        The inner REPLACE() removes the characters from the third character of the last name onward, whilst the outer REPLACE() removes the characters from the third character of the first name up until the space.





        Addendum 1:



        The above formula can also be adapted to allow for a single middle name:



        =REPLACE(REPLACE(A1,IFERROR(FIND(" ",A1,FIND(" ",A1)+1),FIND(" ",A1))+3,LEN(A1),""),3,IFERROR(FIND(" ",A1,FIND(" ",A1)+1),FIND(" ",A1))-2,"")


        This (long-winded) version allows for any number of middle names:



        =REPLACE(REPLACE(A1,FIND("§",SUBSTITUTE(A1," ","§",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))+3,LEN(A1),""),3,FIND("§",SUBSTITUTE(A1," ","§",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))-2,"")


        Note that, of course, BruceWayne's answer is the simplest and easiest to understand solution that allows for any number of middle names.





        Addendum 2:



        All of the solutions can be adapted to cater for the case of a single name only by wrapping them within an IFERROR() function like so:



        =IFERROR(solution, alternate_formula)



        Note that the above is a general case formula, and it might be possible to tailor a more efficient modification to a specific solution. For example, if the requirement in the case of a single name is to join the first two letters with the last two letters, PeterH's answer can be more efficiently adapted like this:



        =LEFT(A1,2)&MID(A1,IFERROR(SEARCH(" ",A1)+1,LEN(A1)-1),2)




        To allow for the case of an initial instead of the first name (assuming a space or dot is not acceptable as the second character) the following can be used with any solution:



        =SUBSTITUTE(SUBSTITUTE(solution, " ", single_char), ".", single_char))



        Note that the single character can be either hard-coded or calculated from the name.





        Finally, if you really need to cater for a single character only for the full name (!), just wrap the single-name-only formula with another IFERROR(). (Assuming, of course, that the alternate formula doesn't take care of that special case.)





        Addendum 3:



        Finally, finally (no, really ;-) ) to cater for multiple consecutive spaces, use TRIM(A1) instead of A1.






        share|improve this answer














        First off, I'd like to say that PeterH's answer is the simplest and easiest to understand. (Although my preference is to use FIND() instead of SEARCH() - typing two less characters helps in avoiding RSI ;-) )



        An alternative answer that neither uses MID(), LEFT() nor RIGHT(), but instead uses REPLACE() to remove the unwanted parts of the name is as follows:



        =REPLACE(REPLACE(A1,FIND(" ",A1)+3,LEN(A1),""),3,FIND(" ",A1)-2,"")


        Explanation:



        The inner REPLACE() removes the characters from the third character of the last name onward, whilst the outer REPLACE() removes the characters from the third character of the first name up until the space.





        Addendum 1:



        The above formula can also be adapted to allow for a single middle name:



        =REPLACE(REPLACE(A1,IFERROR(FIND(" ",A1,FIND(" ",A1)+1),FIND(" ",A1))+3,LEN(A1),""),3,IFERROR(FIND(" ",A1,FIND(" ",A1)+1),FIND(" ",A1))-2,"")


        This (long-winded) version allows for any number of middle names:



        =REPLACE(REPLACE(A1,FIND("§",SUBSTITUTE(A1," ","§",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))+3,LEN(A1),""),3,FIND("§",SUBSTITUTE(A1," ","§",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))-2,"")


        Note that, of course, BruceWayne's answer is the simplest and easiest to understand solution that allows for any number of middle names.





        Addendum 2:



        All of the solutions can be adapted to cater for the case of a single name only by wrapping them within an IFERROR() function like so:



        =IFERROR(solution, alternate_formula)



        Note that the above is a general case formula, and it might be possible to tailor a more efficient modification to a specific solution. For example, if the requirement in the case of a single name is to join the first two letters with the last two letters, PeterH's answer can be more efficiently adapted like this:



        =LEFT(A1,2)&MID(A1,IFERROR(SEARCH(" ",A1)+1,LEN(A1)-1),2)




        To allow for the case of an initial instead of the first name (assuming a space or dot is not acceptable as the second character) the following can be used with any solution:



        =SUBSTITUTE(SUBSTITUTE(solution, " ", single_char), ".", single_char))



        Note that the single character can be either hard-coded or calculated from the name.





        Finally, if you really need to cater for a single character only for the full name (!), just wrap the single-name-only formula with another IFERROR(). (Assuming, of course, that the alternate formula doesn't take care of that special case.)





        Addendum 3:



        Finally, finally (no, really ;-) ) to cater for multiple consecutive spaces, use TRIM(A1) instead of A1.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 1 hour ago

























        answered 8 hours ago









        robinCTS

        3,84041527




        3,84041527






















            prweq is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded


















            prweq is a new contributor. Be nice, and check out our Code of Conduct.













            prweq is a new contributor. Be nice, and check out our Code of Conduct.












            prweq is a new contributor. Be nice, and check out our Code of Conduct.
















            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.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • 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%2f1382305%2fcombining-first-two-letters-from-first-name-and-first-two-letters-from-last-name%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

            Mont Emei

            Province de Neuquén

            Journaliste