# Formula for detecting a sheet

#### sassriverrat

##### Well-known Member
I have this formula that I've got working IF the sheet "Arrival" already exists. However, would would I go about using this if Arrival doesn't exist? I know how I could create it with vba but trying to figure out how to do it with a formula.

Thanks

### Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

#### jasonb75

##### Well-known Member
Do you mean that you want the formula to create the sheet? That is not possible, a formula can only give you an answer, it can not change something else.

#### Special-K99

##### Well-known Member
I have this formula that I've got working IF the sheet "Arrival" already exists. However, would would I go about using this if Arrival doesn't exist? I know how I could create it with vba but trying to figure out how to do it with a formula.

Thanks
What do you want to happen if the sheet exists?
What do you want to happen if the sheet doesn't exist?

#### sassriverrat

##### Well-known Member
On "Sheet", if sheet "Arrival" Exists, I'd like Sheet!A1=Arrival!A1 and if "Arrival" doesn't exist, I'd like Sheet!A1=Sheet!A2

#### Special-K99

##### Well-known Member
Does this work?

in Sheet1!A1
=IFERROR(Arrival!A1,Sheet!A2)

#### KOKOSEK

##### Board Regular
Try like this:

Code:
=IF(ISREF(INDIRECT("Arrival"&"!A1")),"exists","not exists")

#### sassriverrat

##### Well-known Member
Try like this:

Code:
=IF(ISREF(INDIRECT("Arrival"&"!A1")),"exists","not exists")
So this works- Thanks!
@Special-K99

Yours didn't work because it through a reference error when the sheet didn't exist

Last edited: