Unexpected Results in Referencing another worksheet indirectly
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 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
add a comment |
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 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
add a comment |
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 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
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 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
microsoft-excel-2010 vba microsoft-office
asked Dec 15 '18 at 2:33
sirplussirplus
213
213
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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 repeatedRow 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")
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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 repeatedRow 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")
add a comment |
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 repeatedRow 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")
add a comment |
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 repeatedRow 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")
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 repeatedRow 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")
edited Dec 15 '18 at 12:19
answered Dec 15 '18 at 12:01
Jim DannerJim Danner
1012
1012
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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