Find position of first uppercase character in excel string












2














I need to find the position of the first uppercase character in an Excel string. There are lots of resources on the web that have the same (or effectively the same) solution for this:



=MIN(IF(ISERROR(FIND(CHAR(ROW(INDIRECT("65:90"))),A1)),"",FIND(CHAR(ROW(INDIRECT("65:90"))),A1)))


However, this is an unusual usage of the functions. I couldn't find an explanation of exactly what it does and how it works. When I use this formula myself, it doesn't seem to work.



Can someone explain how this formula works so I can figure out what I might be doing wrong?





Note: revision 2 includes my own answer. The original version was put on hold, and I gather the main issue was that I included the answer in the "question" part of the post. If the question is taken off hold I will make the answer an answer and delete this note.










share|improve this question
























  • @fixer1234, can I now add my answer as an answer? Would that be the right thing to do?
    – pateksan
    Dec 14 at 12:24






  • 1




    Absolutely! Go for it. :-)
    – fixer1234
    Dec 14 at 13:02
















2














I need to find the position of the first uppercase character in an Excel string. There are lots of resources on the web that have the same (or effectively the same) solution for this:



=MIN(IF(ISERROR(FIND(CHAR(ROW(INDIRECT("65:90"))),A1)),"",FIND(CHAR(ROW(INDIRECT("65:90"))),A1)))


However, this is an unusual usage of the functions. I couldn't find an explanation of exactly what it does and how it works. When I use this formula myself, it doesn't seem to work.



Can someone explain how this formula works so I can figure out what I might be doing wrong?





Note: revision 2 includes my own answer. The original version was put on hold, and I gather the main issue was that I included the answer in the "question" part of the post. If the question is taken off hold I will make the answer an answer and delete this note.










share|improve this question
























  • @fixer1234, can I now add my answer as an answer? Would that be the right thing to do?
    – pateksan
    Dec 14 at 12:24






  • 1




    Absolutely! Go for it. :-)
    – fixer1234
    Dec 14 at 13:02














2












2








2


2





I need to find the position of the first uppercase character in an Excel string. There are lots of resources on the web that have the same (or effectively the same) solution for this:



=MIN(IF(ISERROR(FIND(CHAR(ROW(INDIRECT("65:90"))),A1)),"",FIND(CHAR(ROW(INDIRECT("65:90"))),A1)))


However, this is an unusual usage of the functions. I couldn't find an explanation of exactly what it does and how it works. When I use this formula myself, it doesn't seem to work.



Can someone explain how this formula works so I can figure out what I might be doing wrong?





Note: revision 2 includes my own answer. The original version was put on hold, and I gather the main issue was that I included the answer in the "question" part of the post. If the question is taken off hold I will make the answer an answer and delete this note.










share|improve this question















I need to find the position of the first uppercase character in an Excel string. There are lots of resources on the web that have the same (or effectively the same) solution for this:



=MIN(IF(ISERROR(FIND(CHAR(ROW(INDIRECT("65:90"))),A1)),"",FIND(CHAR(ROW(INDIRECT("65:90"))),A1)))


However, this is an unusual usage of the functions. I couldn't find an explanation of exactly what it does and how it works. When I use this formula myself, it doesn't seem to work.



Can someone explain how this formula works so I can figure out what I might be doing wrong?





Note: revision 2 includes my own answer. The original version was put on hold, and I gather the main issue was that I included the answer in the "question" part of the post. If the question is taken off hold I will make the answer an answer and delete this note.







microsoft-excel worksheet-function array string






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 13 at 11:20









fixer1234

17.7k144581




17.7k144581










asked Dec 11 at 12:52









pateksan

263




263












  • @fixer1234, can I now add my answer as an answer? Would that be the right thing to do?
    – pateksan
    Dec 14 at 12:24






  • 1




    Absolutely! Go for it. :-)
    – fixer1234
    Dec 14 at 13:02


















  • @fixer1234, can I now add my answer as an answer? Would that be the right thing to do?
    – pateksan
    Dec 14 at 12:24






  • 1




    Absolutely! Go for it. :-)
    – fixer1234
    Dec 14 at 13:02
















@fixer1234, can I now add my answer as an answer? Would that be the right thing to do?
– pateksan
Dec 14 at 12:24




@fixer1234, can I now add my answer as an answer? Would that be the right thing to do?
– pateksan
Dec 14 at 12:24




1




1




Absolutely! Go for it. :-)
– fixer1234
Dec 14 at 13:02




Absolutely! Go for it. :-)
– fixer1234
Dec 14 at 13:02










1 Answer
1






active

oldest

votes


















0














To simplify the mechanism behind the Array formula to return the position of the 1st capital letter in string , insted of your's, I've used a simple Formula will help you to realize the method.



{=MATCH(1,(CODE(MID(B2,ROW($A$1:$A$255),1))<=90)*(CODE(MID(B2,ROW($A$1:$A$255),1))>=65),FALSE)}


How the formula works:




  • Since it's an Array Formula, so it needs to be finished with Control+Shift+Enter.

  • Formula assumes that the capital letter would not be more than 255 characters.

  • With Match, 1 is for TRUE.


  • CODE(MID(B2,ROW($A$1:$A$255),1)), returns an array of ASCII characters that make up the string, returns a 255 element array.


Suppose in B2 value is TxtDate.




  • Then Formula returns,{84;120;116;68;97;116;101}.


CODE(MID(B2,ROW($A$1:$A$255),1))<=90,
returns an array of TRUE and FALSE based on whether or not the ASCII code is less than or equal to 90, where 90 is the ASCII code for capital Z and will return,



{TRUE;FALSE;FALSE;TRUE;FALSE;FALSE;FALSE}



Here the 1st alphabet T has an ASCII code less than 90.



The 3rd part of the Formula checks for ASCII codes greater than or equal to 65, where 65 is for capital A, returns similar array which is then multiplied by the first array.



In Excel, FALSE is equivalent to zero and TRUE is to one. After Formula multiplies these set of Arrays, it gets an Array with Ones & Zeros. Which looks like this.



{1;0;0;1;0;0;0}



Shows, at position 1 and 4 are capital letters. Now the Formula uses the MATCH function to find the 1st Caps in the array and returns 1.



I do believe that above example with explanation will help you to understand that how the Formula works.






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%2f1382625%2ffind-position-of-first-uppercase-character-in-excel-string%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    To simplify the mechanism behind the Array formula to return the position of the 1st capital letter in string , insted of your's, I've used a simple Formula will help you to realize the method.



    {=MATCH(1,(CODE(MID(B2,ROW($A$1:$A$255),1))<=90)*(CODE(MID(B2,ROW($A$1:$A$255),1))>=65),FALSE)}


    How the formula works:




    • Since it's an Array Formula, so it needs to be finished with Control+Shift+Enter.

    • Formula assumes that the capital letter would not be more than 255 characters.

    • With Match, 1 is for TRUE.


    • CODE(MID(B2,ROW($A$1:$A$255),1)), returns an array of ASCII characters that make up the string, returns a 255 element array.


    Suppose in B2 value is TxtDate.




    • Then Formula returns,{84;120;116;68;97;116;101}.


    CODE(MID(B2,ROW($A$1:$A$255),1))<=90,
    returns an array of TRUE and FALSE based on whether or not the ASCII code is less than or equal to 90, where 90 is the ASCII code for capital Z and will return,



    {TRUE;FALSE;FALSE;TRUE;FALSE;FALSE;FALSE}



    Here the 1st alphabet T has an ASCII code less than 90.



    The 3rd part of the Formula checks for ASCII codes greater than or equal to 65, where 65 is for capital A, returns similar array which is then multiplied by the first array.



    In Excel, FALSE is equivalent to zero and TRUE is to one. After Formula multiplies these set of Arrays, it gets an Array with Ones & Zeros. Which looks like this.



    {1;0;0;1;0;0;0}



    Shows, at position 1 and 4 are capital letters. Now the Formula uses the MATCH function to find the 1st Caps in the array and returns 1.



    I do believe that above example with explanation will help you to understand that how the Formula works.






    share|improve this answer




























      0














      To simplify the mechanism behind the Array formula to return the position of the 1st capital letter in string , insted of your's, I've used a simple Formula will help you to realize the method.



      {=MATCH(1,(CODE(MID(B2,ROW($A$1:$A$255),1))<=90)*(CODE(MID(B2,ROW($A$1:$A$255),1))>=65),FALSE)}


      How the formula works:




      • Since it's an Array Formula, so it needs to be finished with Control+Shift+Enter.

      • Formula assumes that the capital letter would not be more than 255 characters.

      • With Match, 1 is for TRUE.


      • CODE(MID(B2,ROW($A$1:$A$255),1)), returns an array of ASCII characters that make up the string, returns a 255 element array.


      Suppose in B2 value is TxtDate.




      • Then Formula returns,{84;120;116;68;97;116;101}.


      CODE(MID(B2,ROW($A$1:$A$255),1))<=90,
      returns an array of TRUE and FALSE based on whether or not the ASCII code is less than or equal to 90, where 90 is the ASCII code for capital Z and will return,



      {TRUE;FALSE;FALSE;TRUE;FALSE;FALSE;FALSE}



      Here the 1st alphabet T has an ASCII code less than 90.



      The 3rd part of the Formula checks for ASCII codes greater than or equal to 65, where 65 is for capital A, returns similar array which is then multiplied by the first array.



      In Excel, FALSE is equivalent to zero and TRUE is to one. After Formula multiplies these set of Arrays, it gets an Array with Ones & Zeros. Which looks like this.



      {1;0;0;1;0;0;0}



      Shows, at position 1 and 4 are capital letters. Now the Formula uses the MATCH function to find the 1st Caps in the array and returns 1.



      I do believe that above example with explanation will help you to understand that how the Formula works.






      share|improve this answer


























        0












        0








        0






        To simplify the mechanism behind the Array formula to return the position of the 1st capital letter in string , insted of your's, I've used a simple Formula will help you to realize the method.



        {=MATCH(1,(CODE(MID(B2,ROW($A$1:$A$255),1))<=90)*(CODE(MID(B2,ROW($A$1:$A$255),1))>=65),FALSE)}


        How the formula works:




        • Since it's an Array Formula, so it needs to be finished with Control+Shift+Enter.

        • Formula assumes that the capital letter would not be more than 255 characters.

        • With Match, 1 is for TRUE.


        • CODE(MID(B2,ROW($A$1:$A$255),1)), returns an array of ASCII characters that make up the string, returns a 255 element array.


        Suppose in B2 value is TxtDate.




        • Then Formula returns,{84;120;116;68;97;116;101}.


        CODE(MID(B2,ROW($A$1:$A$255),1))<=90,
        returns an array of TRUE and FALSE based on whether or not the ASCII code is less than or equal to 90, where 90 is the ASCII code for capital Z and will return,



        {TRUE;FALSE;FALSE;TRUE;FALSE;FALSE;FALSE}



        Here the 1st alphabet T has an ASCII code less than 90.



        The 3rd part of the Formula checks for ASCII codes greater than or equal to 65, where 65 is for capital A, returns similar array which is then multiplied by the first array.



        In Excel, FALSE is equivalent to zero and TRUE is to one. After Formula multiplies these set of Arrays, it gets an Array with Ones & Zeros. Which looks like this.



        {1;0;0;1;0;0;0}



        Shows, at position 1 and 4 are capital letters. Now the Formula uses the MATCH function to find the 1st Caps in the array and returns 1.



        I do believe that above example with explanation will help you to understand that how the Formula works.






        share|improve this answer














        To simplify the mechanism behind the Array formula to return the position of the 1st capital letter in string , insted of your's, I've used a simple Formula will help you to realize the method.



        {=MATCH(1,(CODE(MID(B2,ROW($A$1:$A$255),1))<=90)*(CODE(MID(B2,ROW($A$1:$A$255),1))>=65),FALSE)}


        How the formula works:




        • Since it's an Array Formula, so it needs to be finished with Control+Shift+Enter.

        • Formula assumes that the capital letter would not be more than 255 characters.

        • With Match, 1 is for TRUE.


        • CODE(MID(B2,ROW($A$1:$A$255),1)), returns an array of ASCII characters that make up the string, returns a 255 element array.


        Suppose in B2 value is TxtDate.




        • Then Formula returns,{84;120;116;68;97;116;101}.


        CODE(MID(B2,ROW($A$1:$A$255),1))<=90,
        returns an array of TRUE and FALSE based on whether or not the ASCII code is less than or equal to 90, where 90 is the ASCII code for capital Z and will return,



        {TRUE;FALSE;FALSE;TRUE;FALSE;FALSE;FALSE}



        Here the 1st alphabet T has an ASCII code less than 90.



        The 3rd part of the Formula checks for ASCII codes greater than or equal to 65, where 65 is for capital A, returns similar array which is then multiplied by the first array.



        In Excel, FALSE is equivalent to zero and TRUE is to one. After Formula multiplies these set of Arrays, it gets an Array with Ones & Zeros. Which looks like this.



        {1;0;0;1;0;0;0}



        Shows, at position 1 and 4 are capital letters. Now the Formula uses the MATCH function to find the 1st Caps in the array and returns 1.



        I do believe that above example with explanation will help you to understand that how the Formula works.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Dec 14 at 10:41

























        answered Dec 14 at 8:10









        Rajesh S

        3,6481522




        3,6481522






























            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.





            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%2f1382625%2ffind-position-of-first-uppercase-character-in-excel-string%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

            How do I know what Microsoft account the skydrive app is syncing to?

            Grease: Live!

            When does type information flow backwards in C++?