How do I check if a worksheet exists in my workbook ?

G

Guest

Hi,
I am trying to set up a number of columns (1-52 wks) which are populated by
the data from several other worksheets (Wk1 - 52) within the same Workbook
using Vlookup.

If the the Weeks data has not been added yet (does not exist) I would like
to display "No Data" in all of the cells that lookup.

Does anyone know how I can check if the worksheet has been added yet before
looking up the data.

I was hoping there may be a function called exists ?

e.g. if ('Wk 26' exists, Vlookup(A1,Wk26_data,18,false),"No Data")

Any help would be appreciated.

Thanks
 
S

Sharad Naik

Use ISERROR.
e.g.

IF(ISERROR(Vlookup(A1,Wk26_data,18,false)),"No
Data",Vlookup(A1,Wk26_data,18,false))

So the same Vlookup appears twice, first to check if this Vlookup will give
an error (because sheet Wk26
does not exist, If this is true (i.e. it gives error,) then set value 'No
Data', else set to the same Vlookup.

Sharad
 
D

Dave Peterson

How about:

=IF(ISERROR(CELL("Address",INDIRECT("'wk 26'!A1"))),"No Data",
VLOOKUP(A2,INDIRECT("'wk 26'!A:Z"),18,FALSE))

All one cell
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top