0
votes

So I'm not sure how to word this question, therefore I'm note sure if its already been answered and I'm just not searching for the correct result.

I am working Google Sheets (as required by the tools available).

I have a spreadsheet with multiple sheets.

In the sheet, I have the following basic setup:

SheetA: contains values in two columns. Column A is the index, Column B is the value

SheetB: Contains values in 3 columns. Column A is the index (matches SheetA, Column B is the row from sheet A where the index value is located Or 0 if the index doesn't exist on Sheet1, Column C is the result value I want.

So, I have been using this code in column C of Sheet 2:

Code Snippet 1

=if($B2<>0,concatenate("=",(concatenate("'SheetA'!D",B2))),0)

This results in the code I want

Code snippet 2

='SheetA'!D6

The code above is the cell reference I want the cell in column C to have, but I can't get Google Sheets to read it as a function, instead of as just a string.

Any ideas on how I can force Sheets to take the output of Code Snippet 1 and read it as a function to pull the data from SheetA?

I'm very sorry if this is a confusing read, I'm not sure I'm even on the right track here, or if Sheets can do what I want it to in this case.

1

1 Answers

1
votes

Use the INDIRECT() function:

=if($B2<>0,INDIRECT("'SheetA'!D"&B2),0)