Unexpected Results in Referencing another worksheet indirectly












0















I'm not getting the expected reference
result in the following Scenario



Can someone please explain this.



Create a workbook with 2 x WorkSheets , Sheet1 & Sheet2



Populate Sheet2 Col A1 Down with the following




"Header","Row2","Row3","Row4","Row5","Row6","Row7","Row8","Row9"




Create a Named Range "Header" LOCAL to Sheet2 on Referring to Sheet2!A1



Populate Sheet1 Col A1 Down to Row9 inclusive with the following




=OFFSET(INDIRECT("Sheet2"&"!Header"),0,0,COUNTA(INDIRECT("Sheet2"&"!$A:$A")),1)




Populate Sheet1 B2 Down to B9 inclusive with the following




="Row is " & ROW(OFFSET(INDIRECT("Sheet2"&"!$Header"),0,0,COUNTA(INDIRECT("Sheet2"&"!$A:$A")),1))




The Result I expected



The Result I expected



The Result I got



The Result I got



Given that no relative references are used and the "Correct/Expected" row reference is returned by the formula in Sheet1 Col B yet get an unexpected result in Sheet1 Col A; what's going on.



PS
I have to make data validation on one sheet referring to dynamic local references on other sheets work and need to understand the results above to make this fly.










share|improve this question



























    0















    I'm not getting the expected reference
    result in the following Scenario



    Can someone please explain this.



    Create a workbook with 2 x WorkSheets , Sheet1 & Sheet2



    Populate Sheet2 Col A1 Down with the following




    "Header","Row2","Row3","Row4","Row5","Row6","Row7","Row8","Row9"




    Create a Named Range "Header" LOCAL to Sheet2 on Referring to Sheet2!A1



    Populate Sheet1 Col A1 Down to Row9 inclusive with the following




    =OFFSET(INDIRECT("Sheet2"&"!Header"),0,0,COUNTA(INDIRECT("Sheet2"&"!$A:$A")),1)




    Populate Sheet1 B2 Down to B9 inclusive with the following




    ="Row is " & ROW(OFFSET(INDIRECT("Sheet2"&"!$Header"),0,0,COUNTA(INDIRECT("Sheet2"&"!$A:$A")),1))




    The Result I expected



    The Result I expected



    The Result I got



    The Result I got



    Given that no relative references are used and the "Correct/Expected" row reference is returned by the formula in Sheet1 Col B yet get an unexpected result in Sheet1 Col A; what's going on.



    PS
    I have to make data validation on one sheet referring to dynamic local references on other sheets work and need to understand the results above to make this fly.










    share|improve this question

























      0












      0








      0








      I'm not getting the expected reference
      result in the following Scenario



      Can someone please explain this.



      Create a workbook with 2 x WorkSheets , Sheet1 & Sheet2



      Populate Sheet2 Col A1 Down with the following




      "Header","Row2","Row3","Row4","Row5","Row6","Row7","Row8","Row9"




      Create a Named Range "Header" LOCAL to Sheet2 on Referring to Sheet2!A1



      Populate Sheet1 Col A1 Down to Row9 inclusive with the following




      =OFFSET(INDIRECT("Sheet2"&"!Header"),0,0,COUNTA(INDIRECT("Sheet2"&"!$A:$A")),1)




      Populate Sheet1 B2 Down to B9 inclusive with the following




      ="Row is " & ROW(OFFSET(INDIRECT("Sheet2"&"!$Header"),0,0,COUNTA(INDIRECT("Sheet2"&"!$A:$A")),1))




      The Result I expected



      The Result I expected



      The Result I got



      The Result I got



      Given that no relative references are used and the "Correct/Expected" row reference is returned by the formula in Sheet1 Col B yet get an unexpected result in Sheet1 Col A; what's going on.



      PS
      I have to make data validation on one sheet referring to dynamic local references on other sheets work and need to understand the results above to make this fly.










      share|improve this question














      I'm not getting the expected reference
      result in the following Scenario



      Can someone please explain this.



      Create a workbook with 2 x WorkSheets , Sheet1 & Sheet2



      Populate Sheet2 Col A1 Down with the following




      "Header","Row2","Row3","Row4","Row5","Row6","Row7","Row8","Row9"




      Create a Named Range "Header" LOCAL to Sheet2 on Referring to Sheet2!A1



      Populate Sheet1 Col A1 Down to Row9 inclusive with the following




      =OFFSET(INDIRECT("Sheet2"&"!Header"),0,0,COUNTA(INDIRECT("Sheet2"&"!$A:$A")),1)




      Populate Sheet1 B2 Down to B9 inclusive with the following




      ="Row is " & ROW(OFFSET(INDIRECT("Sheet2"&"!$Header"),0,0,COUNTA(INDIRECT("Sheet2"&"!$A:$A")),1))




      The Result I expected



      The Result I expected



      The Result I got



      The Result I got



      Given that no relative references are used and the "Correct/Expected" row reference is returned by the formula in Sheet1 Col B yet get an unexpected result in Sheet1 Col A; what's going on.



      PS
      I have to make data validation on one sheet referring to dynamic local references on other sheets work and need to understand the results above to make this fly.







      microsoft-excel-2010 vba microsoft-office






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 15 '18 at 2:33









      sirplussirplus

      213




      213






















          1 Answer
          1






          active

          oldest

          votes


















          0














          The OFFSET function returns a range. With the arguments you use, it is a 9 x 1 range (height=9 rows, width=1 column) referring to A1:A9 from Sheet2.



          The behavior of ranges is sometimes surprising, as you have seen. It differs with the way you use the range.




          • When you apply the ROW function to a range, it returns the number of the top row of the range - regardless of the place from where you're using the function. This is the repeated Row is 1 you got in column B.

          • But when you refer to the contents of the range - as you do in your formula in column A of Sheet1 - the location where you make the reference matters. Excel will return the contents of the cell within the range that is at the same height as the cell from where you're using the reference.


          This is also the case with other references to ranges. For example, if you put



          =Sheet2!A:A


          in cell D4 on Sheet1, it will link to cell A4 of Sheet2: the one that is at the same height within the range to which you linked, containing Row4. Or if you create a named range Alldata for the cell block A1:A9, then in cell F7



          =Alldata


          will give you a reference to A7, containing Row7.



          Thus, if you only wanted to refer to the cell at the top, you can make it a cell reference instead of a range (that is, a 1x1 range):



          =OFFSET(INDIRECT("Sheet2"&"!Header"),0,0,1,1)


          or completely leave out the height and width dimensions:



          =OFFSET(INDIRECT("Sheet2"&"!Header"),0,0)


          or just link to the cell:



          =INDIRECT("Sheet2"&"!Header")





          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%2f1383743%2funexpected-results-in-referencing-another-worksheet-indirectly%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














            The OFFSET function returns a range. With the arguments you use, it is a 9 x 1 range (height=9 rows, width=1 column) referring to A1:A9 from Sheet2.



            The behavior of ranges is sometimes surprising, as you have seen. It differs with the way you use the range.




            • When you apply the ROW function to a range, it returns the number of the top row of the range - regardless of the place from where you're using the function. This is the repeated Row is 1 you got in column B.

            • But when you refer to the contents of the range - as you do in your formula in column A of Sheet1 - the location where you make the reference matters. Excel will return the contents of the cell within the range that is at the same height as the cell from where you're using the reference.


            This is also the case with other references to ranges. For example, if you put



            =Sheet2!A:A


            in cell D4 on Sheet1, it will link to cell A4 of Sheet2: the one that is at the same height within the range to which you linked, containing Row4. Or if you create a named range Alldata for the cell block A1:A9, then in cell F7



            =Alldata


            will give you a reference to A7, containing Row7.



            Thus, if you only wanted to refer to the cell at the top, you can make it a cell reference instead of a range (that is, a 1x1 range):



            =OFFSET(INDIRECT("Sheet2"&"!Header"),0,0,1,1)


            or completely leave out the height and width dimensions:



            =OFFSET(INDIRECT("Sheet2"&"!Header"),0,0)


            or just link to the cell:



            =INDIRECT("Sheet2"&"!Header")





            share|improve this answer






























              0














              The OFFSET function returns a range. With the arguments you use, it is a 9 x 1 range (height=9 rows, width=1 column) referring to A1:A9 from Sheet2.



              The behavior of ranges is sometimes surprising, as you have seen. It differs with the way you use the range.




              • When you apply the ROW function to a range, it returns the number of the top row of the range - regardless of the place from where you're using the function. This is the repeated Row is 1 you got in column B.

              • But when you refer to the contents of the range - as you do in your formula in column A of Sheet1 - the location where you make the reference matters. Excel will return the contents of the cell within the range that is at the same height as the cell from where you're using the reference.


              This is also the case with other references to ranges. For example, if you put



              =Sheet2!A:A


              in cell D4 on Sheet1, it will link to cell A4 of Sheet2: the one that is at the same height within the range to which you linked, containing Row4. Or if you create a named range Alldata for the cell block A1:A9, then in cell F7



              =Alldata


              will give you a reference to A7, containing Row7.



              Thus, if you only wanted to refer to the cell at the top, you can make it a cell reference instead of a range (that is, a 1x1 range):



              =OFFSET(INDIRECT("Sheet2"&"!Header"),0,0,1,1)


              or completely leave out the height and width dimensions:



              =OFFSET(INDIRECT("Sheet2"&"!Header"),0,0)


              or just link to the cell:



              =INDIRECT("Sheet2"&"!Header")





              share|improve this answer




























                0












                0








                0







                The OFFSET function returns a range. With the arguments you use, it is a 9 x 1 range (height=9 rows, width=1 column) referring to A1:A9 from Sheet2.



                The behavior of ranges is sometimes surprising, as you have seen. It differs with the way you use the range.




                • When you apply the ROW function to a range, it returns the number of the top row of the range - regardless of the place from where you're using the function. This is the repeated Row is 1 you got in column B.

                • But when you refer to the contents of the range - as you do in your formula in column A of Sheet1 - the location where you make the reference matters. Excel will return the contents of the cell within the range that is at the same height as the cell from where you're using the reference.


                This is also the case with other references to ranges. For example, if you put



                =Sheet2!A:A


                in cell D4 on Sheet1, it will link to cell A4 of Sheet2: the one that is at the same height within the range to which you linked, containing Row4. Or if you create a named range Alldata for the cell block A1:A9, then in cell F7



                =Alldata


                will give you a reference to A7, containing Row7.



                Thus, if you only wanted to refer to the cell at the top, you can make it a cell reference instead of a range (that is, a 1x1 range):



                =OFFSET(INDIRECT("Sheet2"&"!Header"),0,0,1,1)


                or completely leave out the height and width dimensions:



                =OFFSET(INDIRECT("Sheet2"&"!Header"),0,0)


                or just link to the cell:



                =INDIRECT("Sheet2"&"!Header")





                share|improve this answer















                The OFFSET function returns a range. With the arguments you use, it is a 9 x 1 range (height=9 rows, width=1 column) referring to A1:A9 from Sheet2.



                The behavior of ranges is sometimes surprising, as you have seen. It differs with the way you use the range.




                • When you apply the ROW function to a range, it returns the number of the top row of the range - regardless of the place from where you're using the function. This is the repeated Row is 1 you got in column B.

                • But when you refer to the contents of the range - as you do in your formula in column A of Sheet1 - the location where you make the reference matters. Excel will return the contents of the cell within the range that is at the same height as the cell from where you're using the reference.


                This is also the case with other references to ranges. For example, if you put



                =Sheet2!A:A


                in cell D4 on Sheet1, it will link to cell A4 of Sheet2: the one that is at the same height within the range to which you linked, containing Row4. Or if you create a named range Alldata for the cell block A1:A9, then in cell F7



                =Alldata


                will give you a reference to A7, containing Row7.



                Thus, if you only wanted to refer to the cell at the top, you can make it a cell reference instead of a range (that is, a 1x1 range):



                =OFFSET(INDIRECT("Sheet2"&"!Header"),0,0,1,1)


                or completely leave out the height and width dimensions:



                =OFFSET(INDIRECT("Sheet2"&"!Header"),0,0)


                or just link to the cell:



                =INDIRECT("Sheet2"&"!Header")






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Dec 15 '18 at 12:19

























                answered Dec 15 '18 at 12:01









                Jim DannerJim Danner

                1012




                1012






























                    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%2f1383743%2funexpected-results-in-referencing-another-worksheet-indirectly%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

                    Сан-Квентин

                    Алькесар

                    Josef Freinademetz