T. Valko
Well-known Member
- Joined
- May 9, 2009
- Messages
- 16,623
I don't know if this topic has been posted before (I didn't do a search!) but if anyone's interested here's a formula method to list worksheet names.
This uses an old macro function.
Create this defined name:
Insert>Name>Define
Name: SheetNames
Refers to: =GET.WORKBOOK(1)&T(NOW())
OK
Then, to list the sheet names, entered in cell A1:
=INDEX(MID(SheetNames,FIND("]",SheetNames)+1,255),ROWS(A$1:A1))
Copy down until you get errors. Use an error trap if you'd like!
Some notes:
The &T(NOW()) is used to make the formula volatile so that it calculates when a sheet name is changed.
GET.WORKBOOK(1) returns the sheet names as a horizontal array.
1 is the argument index number for returning the sheet names.
Some examples of other uses:
Return the sheet name of the nth sheet (n=2):
=INDEX(MID(SheetNames,FIND("]",SheetNames)+1,255),2)
How many sheet names start with the word Sheet:
=SUMPRODUCT(--(LEFT(INDEX(MID(SheetNames,FIND("]",SheetNames)+1,255),0),4)="Sheet"))
This uses an old macro function.
Create this defined name:
Insert>Name>Define
Name: SheetNames
Refers to: =GET.WORKBOOK(1)&T(NOW())
OK
Then, to list the sheet names, entered in cell A1:
=INDEX(MID(SheetNames,FIND("]",SheetNames)+1,255),ROWS(A$1:A1))
Copy down until you get errors. Use an error trap if you'd like!
Some notes:
The &T(NOW()) is used to make the formula volatile so that it calculates when a sheet name is changed.
GET.WORKBOOK(1) returns the sheet names as a horizontal array.
1 is the argument index number for returning the sheet names.
Some examples of other uses:
Return the sheet name of the nth sheet (n=2):
=INDEX(MID(SheetNames,FIND("]",SheetNames)+1,255),2)
How many sheet names start with the word Sheet:
=SUMPRODUCT(--(LEFT(INDEX(MID(SheetNames,FIND("]",SheetNames)+1,255),0),4)="Sheet"))