Search code examples
excelexcel-formulareferenceformulaformulas

referencing a sheet which has a space in its name


I have a following formula which is refencing Sheet2:

((COUNTIF((INDIRECT("Sheet2!"&ADDRESS(ROW(Sheet2!J4);COLUMN(Sheet2!J4))&":J"& 
(MIN(IF(Sheet2!A4:A107="";ROW(Sheet2!A4:A107))))));"<>"&""))-1)

When i want to change the name of "Sheet2" to "Deployment Plan" and adjust the formula to formula below, it gives an referance error.

((COUNTIF((INDIRECT("DeploymentPlan!"&ADDRESS(ROW(Sheet2!J4);
COLUMN(Sheet2!J4))&":J"& (MIN(IF(Sheet2!A4:A107="";ROW(Sheet2!A4:A107))))));"<>"&""))-1)

I am pretty sure that this error is happening because there is a blank in my new sheet name "Deployment Plan".

How can i adjust my formula so it works correct?


Solution

  • You just need to wrap the name of the worksheet in single quotes (''):

    ((COUNTIF((INDIRECT("'Deployment Plan'!"&ADDRESS(ROW('Deployment Plan'!J4);
    COLUMN('Deployment Plan'!J4))&":J"& (MIN(IF('Deployment Plan'!A4:A107="";ROW('Deployment Plan'!A4:A107))))));"<>"&""))-1)