Condition for worksheet reference

  • Thread starter Thread starter JBoyer
  • Start date Start date
J

JBoyer

This is the function I currently have:
=IF(L2<>"",INDIRECT("'"&L2&"'!B"&ROW($A$2)),"")

I want to modify it in the following way....
=IF(L2<>"", {IF STATEMENT} INDIRECT("'"&L2&"'!B"&ROW($A$2)),"")

I want to add another if statement where shown above to check if there is a
sheet called '"&L2&'"! . So basically IF('"&L2&'"! EXISTS, TRUE, FALSE)

Thanks in advance for any help!
 
That'll work but there is a caveat.

This would probably only apply if you're using the default sheet names.

If the sheet already exists then it's no problem. If the sheet does not
exist and you insert a new sheet the formula will not update until some
event triggers a calculation (like renaming a newly inserted sheet!).
Deleting the sheet referenced will trigger a calcualtion and the formula
would update.
 
Thanks for the info.

T. Valko said:
That'll work but there is a caveat.

This would probably only apply if you're using the default sheet names.

If the sheet already exists then it's no problem. If the sheet does not
exist and you insert a new sheet the formula will not update until some
event triggers a calculation (like renaming a newly inserted sheet!).
Deleting the sheet referenced will trigger a calcualtion and the formula
would update.
 
Back
Top