Formula to return Sheet Number

OK, then we can make the function volatile like this:

=GET.DOCUMENT(87)&T(NOW())

Seems to take care of it.
Let's change that to:

=GET.DOCUMENT(87)+(NOW()*0)

The previous version returned a TEXT number. This new version returns a numeric number.
 
Upvote 0

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Let's change that to:

=GET.DOCUMENT(87)+(NOW()*0)

The previous version returned a TEXT number. This new version returns a numeric number.
Okay, that is better. Very good! By the way, you can remove the surrounding parentheses and it will still work...

=GET.DOCUMENT(87)+NOW()*0
 
Upvote 0
Is there a similar function I can use (VBA is ok) to get the total number of sheets in a workbook?

Thanks!
Again, using a macro function...

Create the defined formula name:
  • SheetNames
  • Refers to: =GET.WORKBOOK(1)&T(NOW())
Then, on the worksheet use this formula:

=COUNTA(SheetNames)
 
Upvote 0
Nice solution T. Valko ! But if I change a sheets visibility to "VeryHidden", how do I exclude that or other "VeryHidden" sheets to be counted?
 
Upvote 0
Nice solution T. Valko ! But if I change a sheets visibility to "VeryHidden", how do I exclude that or other "VeryHidden" sheets to be counted?
That I don't know and I was thinking about that same scenario.

You would probably have to use a UDF.
 
Upvote 0

Forum statistics

Threads
1,215,482
Messages
6,125,058
Members
449,206
Latest member
Healthydogs

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top