In order to check whether a certain worksheet name exists in a workbook or not, we can perform this check with the help of the Excel ISREFand INDIRECT functions. This article demonstrates how to perform this.
Figure 1. Checking Worksheet Name in a Workbook
The generic formula syntax to check the worksheet name in a workbook is;
The Excel ISREF function checks whether a value is a reference and returns TRUE or FALSE and the INDIRECT function returns the reference specified by a text string. In this formula, we can supply the worksheet name as a text value or cell reference and create a full reference of the worksheet name we combine it with an exclamation mark and a general cell reference, such as “!A1”, using the Ampersand symbol (&).
Figure 2. The Syntax of the Formula
Worksheet Name Without Spaces Or Punctuation
The above generic syntax of the formula checks the status of a worksheet name that is without spaces or punctuation in a workbook, like “Mar” or “Payables” etc. Suppose we have different worksheet names in column B that do not contain any space or punctuation and want to check if a worksheet name exists in a workbook. In this case, we will use the following formula in cell C2, such as;
Copy down this formula to return the results for all the listed names of worksheets.
Figure 3. Checking the Worksheet Name Without Spaces Or Punctuation
Worksheet Name With Spaces Or Punctuation
If a worksheet name contains spaces or punctuation, like “Income Statement” and “Balance-Sheet” etc, then we need to amend the generic syntax of formula a little bit. To handle this, we will wrap the worksheet name in the single quotation mark as per the following formula syntax in cell C8 or C9;
=ISREF(INDIRECT(" ' "&sheetname&" ' !A1"))
Figure 4. Checking the Worksheet Name With Spaces Or Punctuation
Instant Connection to an Expert through our Excelchat Service:
Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.