I have the following function in a worksheet. This is repeated multiple time. It works.
=IF(ISNA(VLOOKUP($C14,'PL 2'!$B$2:$Y$128,5,)),0,VLOOKUP($C14,'PL 2'!$B$2:$Y$128,5,))*R$2
Each column refers to a different sheet, from "PL 1" to "PL 50" at present.
I have tried to make it more general, eliminate possible errors and thus simplify extension of the application when adding further columns by using Indirect. The new function is below, and cell R10 = 2:
=INDIRECT("IF(ISNA(VLOOKUP($C14,'PL "&R$10&"'!$B$2:$Y$128,5,)),0,VLOOKUP($C14,'PL "&R$10&"'!$B$2:$Y$128,5,))*R$2")
This comes up with a #REF! error.
Why ?
I have carefully checked & the two functions are identical. I then tried, with the same failure:
=IF(ISNA(INDIRECT("VLOOKUP($C14,'PL "&R$10&"'!$B$2:$Y$128,5,)")),0,INDIRECT("VLOOKUP($C14,'PL "&R$10&"'!$B$2:$Y$128,5,)"))
Also, the following works perfectly:
=IF(ISERROR(INDIRECT("'PL "&R$10&"'!"&"$B3")),"",INDIRECT("'PL "&R$10&"'!"&"$B3"))
=IF(ISNA(VLOOKUP($C14,'PL 2'!$B$2:$Y$128,5,)),0,VLOOKUP($C14,'PL 2'!$B$2:$Y$128,5,))*R$2
Each column refers to a different sheet, from "PL 1" to "PL 50" at present.
I have tried to make it more general, eliminate possible errors and thus simplify extension of the application when adding further columns by using Indirect. The new function is below, and cell R10 = 2:
=INDIRECT("IF(ISNA(VLOOKUP($C14,'PL "&R$10&"'!$B$2:$Y$128,5,)),0,VLOOKUP($C14,'PL "&R$10&"'!$B$2:$Y$128,5,))*R$2")
This comes up with a #REF! error.
Why ?
I have carefully checked & the two functions are identical. I then tried, with the same failure:
=IF(ISNA(INDIRECT("VLOOKUP($C14,'PL "&R$10&"'!$B$2:$Y$128,5,)")),0,INDIRECT("VLOOKUP($C14,'PL "&R$10&"'!$B$2:$Y$128,5,)"))
Also, the following works perfectly:
=IF(ISERROR(INDIRECT("'PL "&R$10&"'!"&"$B3")),"",INDIRECT("'PL "&R$10&"'!"&"$B3"))