ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   INDIRECT function returning REF# (https://www.excelbanter.com/excel-worksheet-functions/225214-indirect-function-returning-ref.html)

Don Kline

INDIRECT function returning REF#
 
I'm trying to find the start of a column on a worksheet. The column start is
based on two variables - row number and column number.

The value of RC2 = "value_Gauranteed Cash Value".

The value of R1C3 is 11. This is the in whiich the "value_Gauranteed Cash
Value" is to be found by the match

"XMLSource" is a worksheet in the same workbook.

The correct answer would be for the function to return 46 - the row number
for the first exact match to the value in RC2.

=MATCH(RC2,INDIRECT("XMLSource!R1C"&R1C3&":R966C"& R1C3),0)

The match is supposed to tell me where in column 11 does it find the exact
match for the value in RC2. What I get is a REF#.

What am I doing wrong?



Bob Bridges[_2_]

INDIRECT function returning REF#
 
I didn't examine this thoroughly, just enough to spot the first error. So
there may be others, but the obvious one is this: INDIRECT assumes that the
string you're handing it expresses the address in A1 format. Since you're
using R1C1, you need to add an extra parameter to the INDIRECT function, like
this:

=MATCH(RC2,INDIRECT("XMLSource!R1C"&R1C3&":R966C"& R1C3,FALSE),0)

I prefer R1C1 myself, which is how I know. :-)

--- "Don Kline" wrote:
I'm trying to find the start of a column on a worksheet. The column start is
based on two variables - row number and column number.

The value of RC2 = "value_Gauranteed Cash Value".

The value of R1C3 is 11. This is the in whiich the "value_Gauranteed Cash
Value" is to be found by the match

"XMLSource" is a worksheet in the same workbook.

The correct answer would be for the function to return 46 - the row number
for the first exact match to the value in RC2.

=MATCH(RC2,INDIRECT("XMLSource!R1C"&R1C3&":R966C"& R1C3),0)

The match is supposed to tell me where in column 11 does it find the exact
match for the value in RC2. What I get is a REF#. What am I doing wrong?


Don Kline[_2_]

INDIRECT function returning REF#
 
A thousand blessings for your speedy and astute reply. I had forgotten that
extra parameter for the R1C1 format.

"Bob Bridges" wrote:

I didn't examine this thoroughly, just enough to spot the first error. So
there may be others, but the obvious one is this: INDIRECT assumes that the
string you're handing it expresses the address in A1 format. Since you're
using R1C1, you need to add an extra parameter to the INDIRECT function, like
this:

=MATCH(RC2,INDIRECT("XMLSource!R1C"&R1C3&":R966C"& R1C3,FALSE),0)

I prefer R1C1 myself, which is how I know. :-)

--- "Don Kline" wrote:
I'm trying to find the start of a column on a worksheet. The column start is
based on two variables - row number and column number.

The value of RC2 = "value_Gauranteed Cash Value".

The value of R1C3 is 11. This is the in whiich the "value_Gauranteed Cash
Value" is to be found by the match

"XMLSource" is a worksheet in the same workbook.

The correct answer would be for the function to return 46 - the row number
for the first exact match to the value in RC2.

=MATCH(RC2,INDIRECT("XMLSource!R1C"&R1C3&":R966C"& R1C3),0)

The match is supposed to tell me where in column 11 does it find the exact
match for the value in RC2. What I get is a REF#. What am I doing wrong?



All times are GMT +1. The time now is 01:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com